mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-17 00:32:21 +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
@@ -7,7 +7,7 @@ import {
|
||||
} from './presentation.js';
|
||||
import { inspectWindAtCenter, WIND_UNITS } from './inspection.js';
|
||||
import { createWindInspectionMarker } from './inspectionMarker.js';
|
||||
import { findQuery } from '../../render/rendererOf.js';
|
||||
import { canvasOf, findQuery } from '../../render/rendererOf.js';
|
||||
import { t, msg, translateKnown } from '../../i18n/index.js';
|
||||
import { unitLabel } from '../../ui/unitLabels.js';
|
||||
|
||||
@@ -81,7 +81,7 @@ export function createWindLayer({
|
||||
};
|
||||
const sample = (position) => {
|
||||
const view = viewer
|
||||
? { query: findQuery(viewer), canvas: viewer.scene?.canvas }
|
||||
? { query: findQuery(viewer), canvas: canvasOf(viewer) }
|
||||
: {};
|
||||
reading = inspectWindAtCenter(manifest, view, {
|
||||
position,
|
||||
|
||||
@@ -317,6 +317,9 @@ test('sample stays fixed across model, field and unit changes; dismissal and dis
|
||||
let center = fromDegrees(0, 0);
|
||||
const viewer = {
|
||||
container,
|
||||
get canvas() {
|
||||
return this.scene?.canvas;
|
||||
},
|
||||
scene: {
|
||||
canvas: { clientWidth: 800, clientHeight: 600, getBoundingClientRect: () => ({ left: 0, top: 0 }) },
|
||||
},
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useWindInspectionStore } from '../../ui/stores/windInspection.js';
|
||||
import { applicationPinia } from '../../ui/vueRuntime.js';
|
||||
import { findFrame, findQuery } from '../../render/rendererOf.js';
|
||||
import { canvasOf, findFrame, findQuery } from '../../render/rendererOf.js';
|
||||
|
||||
/**
|
||||
* One passive marker for the captured location; it never samples on camera
|
||||
@@ -33,7 +33,7 @@ export function createWindInspectionMarker({
|
||||
return {
|
||||
show(position) {
|
||||
clear();
|
||||
const canvas = viewer?.scene?.canvas;
|
||||
const canvas = canvasOf(viewer);
|
||||
const query = viewer ? findQuery(viewer) : null;
|
||||
const frame = viewer ? findFrame(viewer) : null;
|
||||
if (!position || !container?.ownerDocument || !canvas || !query || !frame)
|
||||
|
||||
@@ -26,6 +26,9 @@ function fixture(t) {
|
||||
const projected = [];
|
||||
const requests = [];
|
||||
const viewer = {
|
||||
get canvas() {
|
||||
return this.scene?.canvas;
|
||||
},
|
||||
scene: {
|
||||
canvas: {
|
||||
clientWidth: 800,
|
||||
|
||||
Reference in new issue
Block a user