mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
Keep the context id in the app's entity records instead of on picked objects
registerEntityContext stamped __gevContextId on the entities, primitives and carriers it registered, and selection and pick resolution read it back. It is now the contextId field of the entity's own record.
This commit is contained in:
1 parent
393a145137
commit
2394703c14
5 files changed
+18
-16
No files matched your search
@@ -1,4 +1,5 @@
|
||||
import { getContextStore, isContextRecordActive } from './contextStore.js';
|
||||
import { readEntityRecord } from './entityRecords.js';
|
||||
import { findPickOwner, resolvePickId } from './pickRegistry.js';
|
||||
|
||||
/**
|
||||
@@ -7,8 +8,8 @@ import { findPickOwner, resolvePickId } from './pickRegistry.js';
|
||||
*
|
||||
* Two lanes, in order:
|
||||
* 1. Context-store carriers. Entity-backed layers (infrastructure GeoJSON,
|
||||
* selected vessels, fires, installations) stamp `__gevContextId` on the
|
||||
* picked object, and the store record already carries the label and
|
||||
* selected vessels, fires, installations) write a `contextId` into the
|
||||
* picked object's entity record, and the store record already carries the label and
|
||||
* position voice uses everywhere else.
|
||||
* 2. Pick owners. Primitive-backed layers (aircraft, satellites, vessels)
|
||||
* register an ownership predicate in `pickRegistry`; the owning layer's
|
||||
@@ -52,8 +53,7 @@ function contextCarrierRecord(picked, dataManager) {
|
||||
picked?.primitive?.id,
|
||||
picked?.primitive,
|
||||
]) {
|
||||
const contextId =
|
||||
carrier && typeof carrier === 'object' ? carrier.__gevContextId : null;
|
||||
const contextId = readEntityRecord(carrier)?.contextId;
|
||||
if (!contextId) continue;
|
||||
const record = store.entities.get(contextId);
|
||||
if (record && isContextRecordActive(record, dataManager)) return record;
|
||||
|
||||
Reference in new issue
Block a user