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
@@ -20,6 +20,7 @@
|
||||
* - frame: phases from the scene's own `preUpdate`, `preRender` and
|
||||
* `postRender` events.
|
||||
* - draw: a fake draw port (`fakeDrawPort.mjs`) unless one is given.
|
||||
* - canvas: the double's `canvas`, else its scene's.
|
||||
*/
|
||||
import * as Cesium from 'cesium';
|
||||
import { bindRenderer } from '../render/rendererOf.js';
|
||||
@@ -209,6 +210,15 @@ export function bindFakeCesiumScene(viewer, { draw = fakeDrawPort() } = {}) {
|
||||
};
|
||||
const query = fakeSceneQuery(viewer);
|
||||
const frame = fakeSceneFrame(viewer);
|
||||
const unbind = bindRenderer(viewer, { draw, camera, query, frame });
|
||||
const unbind = bindRenderer(viewer, {
|
||||
// The double's canvas, as `bindFakeCesiumCamera`'s renderer reports it.
|
||||
get canvas() {
|
||||
return viewer.canvas ?? viewer.scene?.canvas;
|
||||
},
|
||||
draw,
|
||||
camera,
|
||||
query,
|
||||
frame,
|
||||
});
|
||||
return { draw, camera, query, frame, unbind };
|
||||
}
|
||||
@@ -94,6 +94,13 @@ export function fakeDrawPort() {
|
||||
*/
|
||||
export function bindFakeDraw(viewer, renderer = {}) {
|
||||
const draw = fakeDrawPort();
|
||||
const unbind = bindRenderer(viewer, { ...renderer, draw });
|
||||
const unbind = bindRenderer(viewer, {
|
||||
// The double's canvas, as `bindFakeCesiumCamera`'s renderer reports it.
|
||||
get canvas() {
|
||||
return viewer.canvas ?? viewer.scene?.canvas;
|
||||
},
|
||||
...renderer,
|
||||
draw,
|
||||
});
|
||||
return { draw, unbind };
|
||||
}
|
||||
Reference in new issue
Block a user