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

+4 -3
View File
@@ -4,6 +4,7 @@ import {
FIRMS_AMBIENT_COHORT_LIMIT,
} from '../../data/firmsLabels.js';
import { MAX_AMBIENT_LABELS, LABEL_VIEW_MARGIN_PX } from './policy.js';
import { canvasOf } from '../../render/rendererOf.js';
export function createCards({
layerState,
@@ -29,7 +30,6 @@ export function createCards({
function rebuildAmbientLabels() {
if (!layerState._viewer) return;
const scene = layerState._viewer.scene;
const { query } = components.rendering.scenePorts();
const project = (position) => query?.project(position) ?? null;
const now = Date.now();
@@ -70,8 +70,9 @@ export function createCards({
}
}
const width = scene.canvas.clientWidth;
const height = scene.canvas.clientHeight;
const canvas = canvasOf(layerState._viewer);
const width = canvas.clientWidth;
const height = canvas.clientHeight;
let ambientCount = 0;
for (const candidate of layerState._labelCandidates) {
+3
View File
@@ -53,6 +53,9 @@ function harness(fires, heightM, { sceneFromViewer = false } = {}) {
heightM,
),
},
get canvas() {
return this.scene?.canvas;
},
scene: {
canvas: { clientWidth: 800, clientHeight: 600 },
preRender: new Cesium.Event(),