feat(app): detection and readout on Navara

The shell creates detection and the tracked readout on the engine, so the
Navara mode has them too (before: not created without a viewer). Detection
reads the camera height from the engine. The tracked readout follows
engine.camera.following(): a follow's plain-data label
(FollowOptions.label: { id, model, position }, the readout card's model
and anchor) or, on Cesium, the followed Entity and its gevLabelModel as
before (Cesium layers keep publishing the same). refreshTrackedReadout
takes a follow handle too. A bare viewer without a registered engine
(tests) is still read for its trackedEntity.

In the app on Navara: "[Detection] Initialized", "[TrackedReadout]
Initialized", and a follow with a label paints its card.
This commit is contained in:
German Khokhlov committed 2026-10-16 21:14:59 +04:00
1 parent 7d5a484796
commit e1be2eac19
7 files changed
+129 -20

No files matched your search

+1
View File
@@ -275,6 +275,7 @@ export function createCesiumFollow(viewer, { commanded }) {
}
state.entity = entity;
state.handle.native = options.native;
state.handle.label = options.label;
viewer.camera.cancelFlight();
viewer.trackedEntity = entity;
const viewFrom =
+4
View File
@@ -143,11 +143,15 @@
* @property {'enu'} [frame]
* @property {any} [native] Cesium only (layers' render/cesium.js): the
* Entity to put on viewer.trackedEntity instead of a proxy.
* @property {{ id: string, model: object | (() => object), position: () => Cartesian3 }} [label]
* The tracked readout's card (src/data/trackedReadout.js): its id, label
* model ({ title, details, accent, ... }) and anchor, as plain data.
*
* @typedef {object} FollowHandle
* @property {() => void} stop
* @property {(next: Partial<FollowOptions>) => void} retarget
* @property {any} [native]
* @property {object} [label] FollowOptions.label.
*
* @typedef {'click'|'doubleClick'|'move'|'down'|'up'} InputType
* @typedef {'ctrl'|'shift'|'alt'} InputModifier
+15
View File
@@ -40,11 +40,24 @@ export function normalizeFollowOptions(options) {
throw new TypeError(`camera.follow minRange must be >= 0: ${minRange}`);
if (options.frame !== undefined && options.frame !== 'enu')
throw new TypeError("camera.follow frame must be 'enu'");
const { label } = options;
if (
label !== undefined &&
!(
label &&
typeof label.id === 'string' &&
typeof label.position === 'function'
)
)
throw new TypeError(
'camera.follow label needs { id, model, position: () => Cartesian3 }',
);
return {
position: options.position,
viewFrom: viewFromOf,
minRange,
native: options.native,
label,
};
}
@@ -305,6 +318,7 @@ export function createFollowController({
const handle = {
options,
native: options.native,
label: options.label,
offset: null,
previous: null,
stop: () => end(handle),
@@ -312,6 +326,7 @@ export function createFollowController({
const updated = normalizeFollowOptions({ ...options, ...next });
handle.options = updated;
handle.native = updated.native;
handle.label = updated.label;
handle.offset = null;
handle.previous = null;
requestRender();