mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
Keep tracked-entity state in app records instead of on Cesium entities
Flights, military, satellites, installations, local ADS-B and ALPR hung gevTrackedId, gevDisplayPosition, gevVisualPosition, gevSelectionOrigin and gevLabelModel on the Cesium entities they draw, and the tracked readout, follow camera, cockpit, share links and awareness read them back. They now live in src/data/entityRecords.js, an app-owned record per entity: layers write entityRecord(entity), readers use readEntityRecord(entity). Nothing changes on screen. This is the first slice of the renderer plan's state mirror (P1). The module is exported as ./data/entity-records so callers can read the same records, and window.__godsEyeView.entityRecords gives the QA scripts the same access from the page.
This commit is contained in:
1 parent
ea69bb4ce2
commit
65587f6c08
53 files changed
+408
-291
No files matched your search
@@ -5,6 +5,7 @@ import {
|
||||
enterCockpitWithTracking,
|
||||
restoreAircraftTrackingOwner,
|
||||
} from './cockpitTracking.js';
|
||||
import { readEntityRecord, withEntityRecord } from './data/entityRecords.js';
|
||||
|
||||
/**
|
||||
* Model the two production stamping seams that sit under this transaction:
|
||||
@@ -22,7 +23,7 @@ function stampingWorld({ entryAllowed = true } = {}) {
|
||||
layerId,
|
||||
trackById(id) {
|
||||
if (!trackable) return false;
|
||||
world.trackedEntity = { gevTrackedId: `${layerId}:${id}` };
|
||||
world.trackedEntity = withEntityRecord({}, { trackedId: `${layerId}:${id}` });
|
||||
stamp('trackedEntityChanged'); // the ui.js listener
|
||||
return true;
|
||||
},
|
||||
@@ -80,7 +81,7 @@ test('a refused Cockpit entry still stamps for the tracker it already moved', ()
|
||||
// Adoption stamped, and the rollback re-track stamped again.
|
||||
assert.deepEqual(world.stamps, ['trackedEntityChanged', 'trackedEntityChanged']);
|
||||
assert.equal(world.generation, 2);
|
||||
assert.equal(world.trackedEntity.gevTrackedId, 'military:ae01ce');
|
||||
assert.equal(readEntityRecord(world.trackedEntity)?.trackedId, 'military:ae01ce');
|
||||
});
|
||||
|
||||
test('a Cockpit entry that mutates nothing takes no camera authority', () => {
|
||||
|
||||
Reference in new issue
Block a user