Read the canvas from the renderer in the layers, voice and tools

Files off the Cesium list sized themselves by, listened on and set the
cursor of `viewer.scene.canvas`. They now read `canvasOf(viewer)` from
src/render/rendererOf.js: the bound renderer's canvas, else the viewer's
own, the same element. Recent Imagery's divider moves the split through the
globe port (`globeSplitTarget`, moved from the flood event into
src/ui/imagerySplit.js), and traffic flow passes the viewer to the listed
surface module (`viewerRoadSurface`) instead of reaching for its scene.

The test fakes give their viewers a canvas, and the fake renderers report
it, as the Cesium renderer reports the viewer's.
This commit is contained in:
Sameh Khamis committed 2026-11-07 18:10:39 -08:00
1 parent abe9f97768
commit b19fa56565
49 files changed
+269 -119

No files matched your search

+8 -3
View File
@@ -17,7 +17,12 @@ import {
TWO_PI,
zeroToTwoPi,
} from '../geo/index.js';
import { findCamera, findFrame, findQuery } from '../render/rendererOf.js';
import {
canvasOf,
findCamera,
findFrame,
findQuery,
} from '../render/rendererOf.js';
import { placeFollowEye } from './shareFollow.js';
function trackedTarget(viewer) {
@@ -55,7 +60,7 @@ function cubicInOut(k) {
/** Return the world position under the center of the canvas, when available. */
export function pickViewTarget(viewer) {
const query = findQuery(viewer);
const canvas = viewer?.scene?.canvas;
const canvas = canvasOf(viewer);
if (!query || !canvas) return null;
const width = canvas.clientWidth || canvas.width || 0;
const height = canvas.clientHeight || canvas.height || 0;
@@ -329,7 +334,7 @@ export function bindCameraOrientationControls({
subscribe(findCamera(viewer)?.on('moveEnd', refreshTilt));
if (viewer) removers.push(onFollowChanged(viewer, animator.cancel));
for (const type of ['pointerdown', 'wheel']) {
const canvas = viewer?.scene?.canvas;
const canvas = canvasOf(viewer);
canvas?.addEventListener?.(type, animator.cancel, { passive: true });
removers.push(() => canvas?.removeEventListener?.(type, animator.cancel));
}