Reach the canvas through canvasOf, not the viewer

Every file that read the renderer's canvas as rendererOf(viewer)?.canvas
falling back to viewer.canvas, and the share restoration's gesture
listeners on viewer.canvas, now ask canvasOf(viewer). The 20 canvas
reach-throughs leave the viewer access record.
This commit is contained in:
Sameh Khamis committed 2026-11-10 17:18:10 -08:00
1 parent 73735b080a
commit ebbe006924
13 files changed
+30 -43

No files matched your search

+2 -2
View File
@@ -25,10 +25,10 @@ import {
import { WORLD_OVERLAY_STYLE } from './worldOverlayTokens.js';
import { t } from '../i18n/index.js';
import {
canvasOf,
findCamera,
findFrame,
findQuery,
rendererOf,
} from '../render/rendererOf.js';
/**
@@ -1308,7 +1308,7 @@ function sizeCanvasSurface(canvas, ctx, width, height, dpr) {
*/
function ensureCanvasSize() {
// The renderer's canvas; a viewer with no renderer bound, its own.
const sceneCanvas = rendererOf(_viewer)?.canvas ?? _viewer?.canvas;
const sceneCanvas = canvasOf(_viewer);
if (!_canvas || !sceneCanvas) return false;
const width = Math.max(0, Math.round(Number(sceneCanvas.clientWidth) || 0));
const height = Math.max(0, Math.round(Number(sceneCanvas.clientHeight) || 0));