Read the camera verbs' and voice actions' canvas from the renderer

The camera verbs size their keyhole fit by the renderer's canvas and listen
on it for the user's input, and the voice actions size their view samples
by it, rather than reaching through `viewer.scene`; a viewer with no
renderer bound answers with its own canvas, the same element. The test
fakes give their viewers a canvas, and a fake camera binding's renderer
reports the fake viewer's.
This commit is contained in:
Sameh Khamis committed 2026-11-07 16:12:43 -08:00
1 parent 20fdfd492e
commit b47aa5f3de
14 files changed
+46 -9

No files matched your search

+7 -1
View File
@@ -75,7 +75,8 @@ export function fakeCameraPort({ pose = {}, viewRectangle = null } = {}) {
* `moveEnd`. A fake with `trackedEntityChanged` and `entities` follows
* through the port, as the renderer does. Its credits are the renderer's
* credits port over the fake's `creditDisplay`, if it has one; `ports`
* adds other ports (a fake draw port, say). Binding a viewer twice keeps the
* adds other ports (a fake draw port, say). The renderer's `canvas` is the
* fake viewer's (`canvas`, else `scene.canvas`). Binding a viewer twice keeps the
* first. Returns the viewer.
* @template {{camera: object}} V
* @param {V} viewer
@@ -189,6 +190,11 @@ export function bindFakeCesiumCamera(viewer, ports = {}) {
},
});
bindRenderer(viewer, {
// The renderer's canvas is the fake's, as the Cesium renderer's is the
// viewer's: read when asked, so a fake that swaps its canvas is seen.
get canvas() {
return viewer.canvas ?? viewer.scene?.canvas;
},
...ports,
camera: port,
credits: fakeCesiumCredits(viewer),