Read what the camera follows through one module

src/data/followed.js answers what the camera follows: the camera port's
target, or the entity a layer still tracks itself, seen through the same
fields. Ownership checks, render holds, guards, voice actions, the CCTV
pacing and the navigation release paths read it instead of Cesium's
trackedEntity, so they keep working when layers follow through the port.
The release paths stop following, cancel the flight and release the
camera through the port. The rotate refusal names the followed target by
its name or label title.
This commit is contained in:
Sameh Khamis committed 2026-11-06 12:27:23 -08:00
1 parent 6c215f93a9
commit 7eec2f828c
29 files changed
+404 -97

No files matched your search

+5 -4
View File
@@ -1,3 +1,4 @@
import { followedOf } from '../../data/followed.js';
import * as Cesium from 'cesium';
import {
GEO_PROGRESS_NOTIFY_INTERVAL_MS,
@@ -125,16 +126,16 @@ export function createGeometryQueue({
* throughput without restarting the queue.
*
* @param {Object} [ownership={}] Current camera-ownership state.
* @param {*} [ownership.trackedEntity] Cesium tracked entity, if any.
* @param {*} [ownership.followed] What the camera follows, if anything.
* @param {boolean} [ownership.cockpitActive] Whether cockpit owns the camera.
* @returns {{ batchSize: number, delayMs: number }} Drain pacing.
*/
function cctvGeometryDrainPacing({
trackedEntity = null,
followed = null,
cockpitActive = false,
} = {}) {
if (trackedEntity || cockpitActive) {
if (followed || cockpitActive) {
return {
batchSize: GEO_TRACKING_BATCH_SIZE,
delayMs: GEO_TRACKING_BATCH_DELAY_MS,
@@ -213,7 +214,7 @@ export function createGeometryQueue({
const batchResult = processCctvGeometryDrainBatch({
queue: layerState._geoQueue,
readOwnership: () => ({
trackedEntity: layerState._viewer.trackedEntity,
followed: followedOf(layerState._viewer),
cockpitActive:
typeof document !== 'undefined' &&
document.body?.classList.contains('cockpit-mode'),
+2 -1
View File
@@ -1,3 +1,4 @@
import { isFollowing } from '../../data/followed.js';
import * as Cesium from 'cesium';
import { CCTV_FOCUS_RESULT } from './policy.js';
import { cameraOf } from '../../render/cesium/camera.js';
@@ -52,7 +53,7 @@ export function createNavigation({
console.debug('[Data:CCTV] focus ignored while cockpit owns the camera');
return CCTV_FOCUS_RESULT.COCKPIT_ACTIVE;
}
if (viewer.trackedEntity) {
if (isFollowing(viewer)) {
console.debug(
'[Data:CCTV] focus ignored while a tracked entity owns the camera',
);