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 -1
View File
@@ -17,6 +17,7 @@ import {
settle,
} from '../layers/recentImagery/testDoubles.mjs';
import { bindFakeCesiumCamera } from '../testSupport/fakeCameraPort.mjs';
import { fakeGlobePort } from '../testSupport/fakeGlobePort.mjs';
const S18 = 'S30:2026-09-18';
const L16 = 'L30:2026-09-16';
@@ -130,7 +131,8 @@ function fixture({ fetchImpl, controller = fakeController() } = {}) {
camera: {},
scene: { canvas: { clientWidth: 1000 }, requestRender() {} },
};
bindFakeCesiumCamera(viewer);
const globe = fakeGlobePort();
bindFakeCesiumCamera(viewer, { globe });
layer.init(viewer);
layer.attachMapStackController(controller);
let active = false;
@@ -213,6 +215,7 @@ function fixture({ fetchImpl, controller = fakeController() } = {}) {
...dom,
layer,
viewer,
globe,
renderer,
thumbnails,
catalog,
@@ -879,6 +882,9 @@ test('the divider exists only while a swipe is live, labelled A / B or IMAGE / B
assert.equal(f.splits.length, 1);
assert.deepEqual(labels(), ['IMAGE', 'BASEMAP']);
assert.equal(f.splits[0].options.id, 'recent-imagery-split-line');
// The divider moves the globe's split, through the renderer's globe port.
f.splits[0].options.scene.splitPosition = 0.3;
assert.equal(f.globe.imagery.getSplit(), 0.3);
assert.deepEqual(swapState(), [false, false, 'false', 'false']);
assert.deepEqual(directions(), ['left', undefined]);
// VS BASEMAP: SWAP puts the image right of the basemap, and back.