Read the navigation and point-and-ask camera through the renderer's ports

The navigation controller and the location navigation cancel flights and
read the camera's place through the camera port. Point-and-ask's camera
pose key and its "around here" radius read the camera port's pose; its
entity pick moves into the input dispatcher (pickAt), which picks as a
click does, so the follow's helper still reads as its target.

navigationController, locationNavigation and pointerPick leave the Cesium
allow-list. Their package entries (./ui/navigation and three voice
entries) no longer load the Cesium adapter: given a viewer of a
caller's own, they find its camera once the caller loads
./render/cesium/unbound. They are listed as such in the unbound camera
test, which fails if one starts loading the factory again.
This commit is contained in:
Sameh Khamis committed 2026-11-07 03:11:51 -08:00
1 parent 3484bfa56d
commit a2c4d27b5a
9 files changed
+92 -35

No files matched your search

+14 -8
View File
@@ -18,6 +18,7 @@
*
* Provider-neutral and Cesium-free: the pick is injected.
*/
import { findCamera } from '../render/rendererOf.js';
/** Movement below this many CSS pixels is still the same dwell. */
const POINTER_DWELL_PX = 12;
@@ -55,23 +56,28 @@ const finite = finiteOrNull;
/**
* Camera pose identity: position to 1 m, orientation to about 0.06 degrees.
* A pixel read under one key names nothing under another. Reads plain
* numbers only, so it needs no Cesium import.
* @param {object} viewer Cesium viewer.
* A pixel read under one key names nothing under another. Reads the
* camera port's pose.
* @param {object} viewer The scene object.
* @returns {string|null}
*/
export function cameraPoseKey(viewer) {
const camera = viewer?.camera;
const p = camera?.positionWC;
let pose = null;
try {
pose = findCamera(viewer)?.pose() ?? null;
} catch {
return null;
}
const p = pose?.position;
if (!p || !Number.isFinite(p.x)) return null;
const angle = (value) => Math.round((Number(value) || 0) * 1000);
return [
Math.round(p.x),
Math.round(p.y),
Math.round(p.z),
angle(camera.heading),
angle(camera.pitch),
angle(camera.roll),
angle(pose.heading),
angle(pose.pitch),
angle(pose.roll),
].join(',');
}