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

+9 -1
View File
@@ -1590,6 +1590,9 @@ test('vessel host publication preserves the shipped grid winner and separation s
const winner = makeCandidate('200', 'NAMED WINNER', 40, 30, 16);
const separated = makeCandidate('300', 'SEPARATED', 400, 300, 3);
const viewer = {
get canvas() {
return this.scene?.canvas;
},
scene: { canvas: { clientWidth: 1600, clientHeight: 900 } },
};
const unbind = bindRenderer(viewer, {
@@ -1657,7 +1660,12 @@ test('vessel real layer lifecycle publishes protected selection and leaves no st
});
_setVesselOverlayHostForTest(host);
_setVesselStateForTest({
viewer: { scene: { canvas: { clientWidth: 1600, clientHeight: 900 } } },
viewer: {
get canvas() {
return this.scene?.canvas;
},
scene: { canvas: { clientWidth: 1600, clientHeight: 900 } },
},
records: [record],
selectedRecord: record,
});
+5 -18
View File
@@ -23,17 +23,17 @@ import {
resolveEmbeddedMediaSource,
} from './bhoteKoshiEmbeddedMedia.js';
import { acquireImageryComparison } from '../maps/imageryComparison.js';
import { createImagerySplit } from '../ui/imagerySplit.js';
import { createImagerySplit, globeSplitTarget } from '../ui/imagerySplit.js';
import { formatDate, t, tn, msg, onLocaleChange } from '../i18n/index.js';
import { useBhoteKoshiPanelStore } from '../ui/stores/bhoteKoshiPanel.js';
import { applicationPinia } from '../ui/vueRuntime.js';
import { heightsOf } from '../queries/heights.js';
import {
cameraOf,
canvasOf,
drawOf,
findCamera,
findGlobe,
rendererOf,
} from '../render/rendererOf.js';
import { hexColor } from '../render/color.js';
import { fromDegrees } from '../geo/ellipsoid.js';
@@ -2704,26 +2704,13 @@ export function createBhoteKoshiEventLayer({
/** The canvas the scene is drawn on, for its pointer events. */
function sceneCanvas() {
if (!_viewer) return null;
return rendererOf(_viewer)?.canvas ?? _viewer.scene?.canvas ?? null;
}
/** The split as the divider moves it: the globe's, through its port. */
function splitScene() {
const imagery = findGlobe(_viewer)?.imagery;
if (!imagery?.setSplit) return null;
return {
get splitPosition() {
return imagery.getSplit();
},
set splitPosition(value) {
imagery.setSplit(value);
},
};
return canvasOf(_viewer);
}
function createSplitControl(event) {
_splitControl = createImagerySplit({
scene: splitScene(),
// The split as the divider moves it: the globe's, through its port.
scene: globeSplitTarget(findGlobe(_viewer)),
initialValue: _split,
id: 'bhote-koshi-split-line',
handleClass: 'bhote-koshi-split-handle',
+3
View File
@@ -231,6 +231,9 @@ test('traffic timing pairs real ordering to the scheduling change and guards re-
setLongitude(longitude);
viewer = {
camera,
get canvas() {
return this.scene?.canvas;
},
scene: {
canvas: { clientWidth: 0, clientHeight: 0, width: 0, height: 0 },
preRender,