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

+3 -3
View File
@@ -12,7 +12,7 @@ import {
vec,
} from '../../geo/vector.js';
import { MISSION_GLOBE_VIEW_RANGE_M, MISSION_FOCUS_RANGE_M } from './policy.js';
import { cameraOf, findCamera } from '../../render/rendererOf.js';
import { cameraOf, canvasOf, findCamera } from '../../render/rendererOf.js';
export function createSelection({
state: layerState,
@@ -23,7 +23,7 @@ export function createSelection({
const { getKeyholeGeometry } = services.geometry;
function focusFullGlobe(viewer, duration = 2.4) {
const canvas = viewer?.scene?.canvas;
const canvas = canvasOf(viewer);
const height = canvas?.clientHeight || canvas?.height;
const width = canvas?.clientWidth || canvas?.width;
if (!(width > 0) || !(height > 0)) return;
@@ -121,7 +121,7 @@ export function createSelection({
const launchPosition = fromDegrees(launch.lon, launch.lat);
let range = 18000000;
if (orbitPositions?.length > 1) {
const canvas = layerState._viewer.scene.canvas;
const canvas = canvasOf(layerState._viewer);
const fovy = camera.pose().fovy || toRadians(60);
const aspect = Math.max(
0.1,