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

+13 -2
View File
@@ -32,7 +32,12 @@ function setup(t) {
state._enabled = true;
state._liveMode = true;
state._pointCollection = new C.PointPrimitiveCollection();
state._viewer = { scene: {} };
state._viewer = {
scene: {},
get canvas() {
return this.scene?.canvas;
},
};
const parts = {
rendering: {
removeHeatLines() {},
@@ -735,6 +740,9 @@ test('selection asks the query port for depth and screen positions, and the came
segmentDist: [11],
});
const viewer = {
get canvas() {
return this.scene?.canvas;
},
scene: {
canvas: { clientWidth: 1000, clientHeight: 800 },
globe: { show: true, tilesLoaded: true, getHeight: () => 0 },
@@ -813,6 +821,9 @@ test('selection asks the query port for depth and screen positions, and the came
test('height easing stops visible waypoints at the camera near plane', () => {
const viewer = {
get canvas() {
return this.scene?.canvas;
},
scene: {
canvas: { clientWidth: 1000, clientHeight: 800 },
camera: {},
@@ -879,7 +890,7 @@ test('height easing through the Cesium ports stops at the near plane of a looked
const centre = C.Cartesian3.fromDegrees(0, 0, 0);
// A transformed camera: lookAt leaves the camera in the target's frame.
scene.camera.lookAt(centre, new C.HeadingPitchRange(0, -0.5, 600));
const viewer = { scene, camera: scene.camera };
const viewer = { scene, camera: scene.camera, canvas: scene.canvas };
const eyeDepth = (p) =>
-C.Matrix4.multiplyByPoint(scene.camera.viewMatrix, p, new C.Cartesian3())
.z;