mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
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:
1 parent
73735b080a
commit
ebbe006924
13 files changed
+30
-43
No files matched your search
@@ -62,7 +62,11 @@ import {
|
||||
import { onLocaleChange, t, translateKnown } from '../i18n/index.js';
|
||||
import { fromDegrees } from '../geo/index.js';
|
||||
import { cssColor } from '../render/color.js';
|
||||
import { drawOf, findFrame, rendererOf } from '../render/rendererOf.js';
|
||||
import {
|
||||
canvasOf as sceneCanvasOf,
|
||||
drawOf,
|
||||
findFrame,
|
||||
} from '../render/rendererOf.js';
|
||||
/** The longest note a row action leaves under its row, in characters. */
|
||||
const NOTE_MAX = 200;
|
||||
/** An action's answer as a row note: trimmed, and cut at a word with an ellipsis. */
|
||||
@@ -157,7 +161,7 @@ export function initDrawTool({
|
||||
previewPoints.dispose();
|
||||
};
|
||||
/** The canvas the renderer draws in (the viewer's own when none is bound). */
|
||||
const canvasOf = () => rendererOf(viewer)?.canvas ?? viewer.canvas;
|
||||
const canvasOf = () => sceneCanvasOf(viewer);
|
||||
const requestRender = () => findFrame(viewer)?.requestRender('draw-preview');
|
||||
// Teardown finishes synchronously; `whenSettled()` keeps its promise.
|
||||
const attaching = Promise.resolve();
|
||||
|
||||
@@ -46,7 +46,7 @@ import { unavailablePlaceSearch } from '../search/placeSearch.js';
|
||||
import { isPickedWorldPosition } from '../data/scenePick.js';
|
||||
import { heightsOf } from '../queries/heights.js';
|
||||
import { fromDegrees, toLonLatH } from '../geo/ellipsoid.js';
|
||||
import { findCamera, findQuery, rendererOf } from '../render/rendererOf.js';
|
||||
import { canvasOf, findCamera, findQuery } from '../render/rendererOf.js';
|
||||
|
||||
/** Prepare only local dateline outlines for planar admission and centering. */
|
||||
function localOutlineFrame(fp) {
|
||||
@@ -2292,7 +2292,7 @@ export function createAnnotationResolver({
|
||||
function pickWorldFromScreen(viewer, nx, ny) {
|
||||
const query = viewer ? findQuery(viewer) : null;
|
||||
// The renderer's canvas; a viewer with no renderer bound, its own.
|
||||
const canvas = rendererOf(viewer)?.canvas ?? viewer?.canvas;
|
||||
const canvas = canvasOf(viewer);
|
||||
if (!query || !canvas) return null;
|
||||
const w = canvas.clientWidth || canvas.width || 0;
|
||||
const h = canvas.clientHeight || canvas.height || 0;
|
||||
|
||||
@@ -12,10 +12,10 @@ import { heightsOf } from '../queries/heights.js';
|
||||
import { fromDegrees, toLonLatH } from '../geo/ellipsoid.js';
|
||||
import { distance } from '../geo/vector.js';
|
||||
import {
|
||||
canvasOf as sceneCanvasOf,
|
||||
findCamera,
|
||||
findFrame,
|
||||
findQuery,
|
||||
rendererOf,
|
||||
} from '../render/rendererOf.js';
|
||||
|
||||
/** A label whose detailed outline could not be resolved. */
|
||||
@@ -93,7 +93,7 @@ export function createScreenAnnotationRenderer(
|
||||
let passQuery = null;
|
||||
let passCanvas = null;
|
||||
// The renderer's canvas; a viewer with no renderer bound, its own.
|
||||
const canvasOf = () => rendererOf(viewer)?.canvas ?? viewer.canvas;
|
||||
const canvasOf = () => sceneCanvasOf(viewer);
|
||||
const records = new Map(); // anno.id -> { key, anno, group, parts }
|
||||
const leaving = new Map(); // key -> a removed mark's record while it fades out
|
||||
const byKey = new Map(); // key -> record, live or fading
|
||||
|
||||
Reference in new issue
Block a user