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

+6 -8
View File
@@ -1,3 +1,4 @@
import { onFollowChanged } from '../../data/followed.js';
import { inputFor } from '../../input/dispatcher.js';
import { VESSEL_OVERLAY_SOURCE_ID } from '../../data/vesselLabels.js';
@@ -97,14 +98,11 @@ export function createSelection({
state.keyTarget = keyTarget;
state.keydownHandler = onVesselKeyDown;
keyTarget.addEventListener('keydown', state.keydownHandler);
// Vessels never set viewer.trackedEntity, so any new tracked entity belongs
// to another layer and takes interaction ownership of the scene.
state.trackedEntityRemover = viewer.trackedEntityChanged.addEventListener(
() => {
if (viewer.trackedEntity && state.selectedRecord)
clearVesselInspection();
},
);
// Vessels never follow, so anything newly followed belongs to another
// layer and takes interaction ownership of the scene.
state.trackedEntityRemover = onFollowChanged(viewer, (followed) => {
if (followed && state.selectedRecord) clearVesselInspection();
});
}
/** Select one live vessel and request one UI-owned camera transfer. */