mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
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:
1 parent
abe9f97768
commit
b19fa56565
49 files changed
+269
-119
No files matched your search
@@ -1,5 +1,5 @@
|
||||
import { toLonLatH } from '../../geo/ellipsoid.js';
|
||||
import { findCamera, findQuery } from '../../render/rendererOf.js';
|
||||
import { canvasOf, findCamera, findQuery } from '../../render/rendererOf.js';
|
||||
import { viewAreaRadiusKm } from './viewArea.js';
|
||||
|
||||
/**
|
||||
@@ -13,7 +13,7 @@ export function vesselViewArea(viewer) {
|
||||
const radiusKm = viewAreaRadiusKm(pose?.height);
|
||||
if (radiusKm == null) return null;
|
||||
let { lat, lon } = pose;
|
||||
const canvas = viewer?.scene?.canvas;
|
||||
const canvas = canvasOf(viewer);
|
||||
if (canvas?.clientWidth && canvas?.clientHeight) {
|
||||
try {
|
||||
const hit = findQuery(viewer)?.pickEllipsoid(
|
||||
|
||||
@@ -7,6 +7,9 @@ import { vesselViewArea } from './cameraArea.js';
|
||||
/** A viewer whose camera and query ports answer as given. */
|
||||
function viewerWith({ height, lon = 4, lat = 52, hit, size = [1600, 900] }) {
|
||||
const viewer = {
|
||||
get canvas() {
|
||||
return this.scene?.canvas;
|
||||
},
|
||||
scene: { canvas: { clientWidth: size[0], clientHeight: size[1] } },
|
||||
};
|
||||
const picks = [];
|
||||
|
||||
@@ -10,6 +10,7 @@ import { fromDegrees } from '../../geo/ellipsoid.js';
|
||||
import { horizonFrom, liftedForHorizon } from '../../geo/horizon.js';
|
||||
import { distance } from '../../geo/vector.js';
|
||||
import {
|
||||
canvasOf,
|
||||
drawOf,
|
||||
findCamera,
|
||||
findFrame,
|
||||
@@ -552,7 +553,7 @@ export function createRendering({
|
||||
*/
|
||||
|
||||
function publishVesselOverlayEntries(entries) {
|
||||
const canvas = state.viewer?.scene?.canvas || state.viewer?.canvas;
|
||||
const canvas = canvasOf(state.viewer);
|
||||
const width = Number(canvas?.clientWidth) || 0;
|
||||
const height = Number(canvas?.clientHeight) || 0;
|
||||
const ambientLimit = vesselOverlayCohortLimit(
|
||||
|
||||
Reference in new issue
Block a user