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
@@ -1,4 +1,4 @@
|
||||
import { findCamera, rendererOf } from '../../render/rendererOf.js';
|
||||
import { canvasOf, findCamera } from '../../render/rendererOf.js';
|
||||
import { renderedFrames } from '../../data/renderedFrames.js';
|
||||
import {
|
||||
fromDegrees,
|
||||
@@ -130,7 +130,7 @@ export function createMotion({
|
||||
* renderer is bound), or 0 without either. */
|
||||
function _viewportHeightPx() {
|
||||
const viewer = flightState._viewer;
|
||||
const canvas = rendererOf(viewer)?.canvas ?? viewer?.canvas;
|
||||
const canvas = canvasOf(viewer);
|
||||
return Number(canvas?.clientHeight) || 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { findCamera, rendererOf } from '../../render/rendererOf.js';
|
||||
import { canvasOf, findCamera } from '../../render/rendererOf.js';
|
||||
import { renderedFrames } from '../../data/renderedFrames.js';
|
||||
import { fromDegrees } from '../../geo/ellipsoid.js';
|
||||
import { eastNorthUp, framePoint } from '../../geo/frames.js';
|
||||
@@ -89,7 +89,7 @@ export function createMotion({
|
||||
* renderer is bound), or 0 without either. */
|
||||
function _viewportHeightPx() {
|
||||
const viewer = flightState._viewer;
|
||||
const canvas = rendererOf(viewer)?.canvas ?? viewer?.canvas;
|
||||
const canvas = canvasOf(viewer);
|
||||
return Number(canvas?.clientHeight) || 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,10 +8,10 @@ import {
|
||||
import { horizonFrom } from '../../geo/horizon.js';
|
||||
import { distance } from '../../geo/vector.js';
|
||||
import {
|
||||
canvasOf,
|
||||
findCamera,
|
||||
findFrame,
|
||||
findQuery,
|
||||
rendererOf,
|
||||
} from '../../render/rendererOf.js';
|
||||
|
||||
/** Equirectangular metres between {lon, lat} points, the short way round ±180°; street scale. */
|
||||
@@ -77,7 +77,7 @@ function raisedEllipsoid(height) {
|
||||
|
||||
/** The CSS size of the canvas the viewer draws on; zeros without one. */
|
||||
export function canvasSize(viewer) {
|
||||
const canvas = rendererOf(viewer)?.canvas ?? viewer?.canvas;
|
||||
const canvas = canvasOf(viewer);
|
||||
return {
|
||||
width: canvas?.clientWidth || canvas?.width || 0,
|
||||
height: canvas?.clientHeight || canvas?.height || 0,
|
||||
|
||||
Reference in new issue
Block a user