Keep the tracked aircraft through a failed engine switch on Cesium

Cesium follows a display's sprite through a proxy Entity that mirrors the
native's readout fields, and gevRestoring was not one of them. A follow
the flights layer resumed on attach therefore read as new navigation to
the shell's tracked-entity watcher, which made the share restore of the
same attach count itself superseded and clear the selection. That is why
the aircraft was lost after a failed switch's rollback onto Cesium, and
after the retry. The proxy now shows the restoring mark while its follow
starts.

The flights renderer test runs a detach, a failed attach to a candidate,
the rollback and a retry on headless Cesium engines, and checks that the
aircraft stays tracked and no navigation is stamped.
This commit is contained in:
German Khokhlov committed 2026-11-07 03:44:38 +04:00
1 parent f06b93fbc9
commit 145adc08e0
3 files changed
+110 -1

No files matched your search

+6 -1
View File
@@ -23,13 +23,18 @@ import { toCesium3 } from './convert.js';
const MAX_FRAME_ATTEMPTS = 120;
const entityName = (entity) => (entity ? entity.name || entity.id : undefined);
// What viewer.trackedEntity readers take from a tracked Entity, read through
// a proxy from the layer's own handle.
// a proxy from the layer's own handle. gevRestoring marks a follow that
// rebinds the session's own subject (a resumed renderer, a share restore)
// while it starts: trackedEntityChanged readers (the shell's navigation
// stamp) must see it on the proxy, or a resumed follow supersedes the
// restore it belongs to.
const READOUT_FIELDS = [
'gevTrackedId',
'gevLabelModel',
'gevDisplayPosition',
'gevVisualPosition',
'gevSelectionOrigin',
'gevRestoring',
];
const ZOOM_INERTIA_STATES = new WeakMap();
+20
View File
@@ -109,6 +109,26 @@ test('a native that is not an Entity is echoed and followed through an ENU proxy
assert.equal(viewer.entities.contains(proxy), false);
});
test("the proxy shows a restoring native's mark while its follow starts", () => {
const { viewer, camera } = setup();
const native = { id: 'flights-tracked-1', gevTrackedId: 'flights:abc123' };
// What trackedEntityChanged readers see as the follow starts.
const seen = [];
viewer.trackedEntityChanged.addEventListener((entity) =>
seen.push(entity?.gevRestoring),
);
native.gevRestoring = true;
const handle = camera.follow({
native,
position: () => TARGET,
viewFrom: () => ({ x: 0, y: -500, z: 200 }),
});
delete native.gevRestoring;
assert.deepEqual(seen, [true]);
assert.equal(viewer.trackedEntity.gevRestoring, undefined, 'read through');
handle.stop();
});
test('a camera command or another tracked entity ends the follow', () => {
const { viewer, camera, changes } = setup();
const options = { position: () => TARGET, viewFrom: { x: 0, y: -500, z: 0 } };