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

+7 -5
View File
@@ -7,6 +7,7 @@ import { fromDegrees } from '../../geo/index.js';
import { horizonFrom } from '../../geo/horizon.js';
import {
cameraOf,
canvasOf,
drawOf,
findFrame,
findQuery,
@@ -57,8 +58,8 @@ export function createNamedMarkers({ state, services, parts, overlayHost }) {
!same(pose.position, lastPose.position) ||
!same(pose.direction, lastPose.direction) ||
!same(pose.up, lastPose.up) ||
width !== viewer.scene.canvas.clientWidth ||
height !== viewer.scene.canvas.clientHeight
width !== canvasOf(viewer).clientWidth ||
height !== canvasOf(viewer).clientHeight
);
}
@@ -69,8 +70,9 @@ export function createNamedMarkers({ state, services, parts, overlayHost }) {
function refresh(pose = null) {
const viewer = state.viewer;
if (!state.enabled || !points) return;
width = viewer.scene.canvas.clientWidth;
height = viewer.scene.canvas.clientHeight;
const canvas = canvasOf(viewer);
width = canvas.clientWidth;
height = canvas.clientHeight;
pose ??= cameraOf(viewer).pose();
lastPose = {
position: { ...pose.position },
@@ -175,7 +177,7 @@ export function createNamedMarkers({ state, services, parts, overlayHost }) {
function sync(records) {
const viewer = state.viewer;
if (!viewer?.scene) return;
if (!viewer) return;
points ??= drawOf(viewer).points({ id: setId, horizonCull: true });
points.show = state.enabled;
const named = records