feat(globe): camera.commanded, picker.pickGlobe, pose.aspectRatio and isDestroyed

Shell navigation needs to know when a new owner takes the camera (the
arrival ground guard), where the globe surface is under a window position
(orientation pivot, view-centred place search), the frustum aspect ratio
(landmark framing) and whether the engine is gone. Each member has a
contract suite check and is implemented by the Cesium engine, the Navara
engine and the fake. On Cesium, commanded hooks the viewer camera's
command methods and trackedEntityChanged only while it has listeners, so
direct Cesium calls from layers still announce a new owner.
This commit is contained in:
German Khokhlov committed 2026-10-15 19:19:41 +04:00
1 parent 840e34a881
commit a3e929870d
16 files changed
+459 -6

No files matched your search

+30
View File
@@ -457,3 +457,33 @@ test('livePosition is one engine-owned object holding the current position; heig
const pose = camera.pose();
assert.notEqual(pose.position, live, 'pose shares the live object');
});
test('commanded fires before each camera command and never for reads', () => {
const { camera } = setup();
let raised = 0;
const remove = camera.commanded.addEventListener(() => raised++);
assert.ok(isEngineEvent(camera.commanded));
camera.pose();
camera.height();
camera.viewRectangle();
assert.equal(raised, 0);
const target = cartesian3.fromDegrees(10, 10, 0);
camera.setView({ destination: cartesian3.fromDegrees(10, 10, 1e6) });
camera.flyTo({ destination: cartesian3.fromDegrees(11, 10, 1e6), duration: 0 });
camera.flyToSphere({ center: target, radius: 10 }, { duration: 0 });
camera.lookAt(target, { heading: 0, pitch: -1, range: 500 });
camera.cancelFlight();
assert.equal(raised, 5);
camera.release();
camera.zoomIn(10);
assert.equal(raised, 5, 'release and zoom are not new owners');
remove();
camera.setView({ destination: cartesian3.fromDegrees(10, 10, 1e6) });
assert.equal(raised, 5);
});
test('pose carries the view aspect ratio', () => {
const { camera, port } = setup();
const { width, height } = port.size();
assert.equal(camera.pose().aspectRatio, width / height);
});