mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-15 15:52:21 +00:00
refactor(ui): navigation, orientation, share links and HUD use the globe engine
The application shell keeps the page's globe engine and hands it to the navigation controller, location navigation (search, city and POI flights, orbit, globe reset), the tilt and north-up controls, share-link save and restore, share restoration's first-gesture listeners and the HUD. The viewer is passed only where entity tracking still lives on it (phase 1c) and to the HUD's basemap label context (voice); every such use is null-safe. Share links and captured shots write heading and roll as Cesium's camera reports them (src/cameraAngles.js): the contract's [0, 2π) pose maps an exact 0 back to Cesium's 2π, except the roll of a vertical view, so links stay byte-identical (heading=360, roll=360) on every engine. Source-reading tests follow the moved code with the same checks.
This commit is contained in:
1 parent
16e63f4c50
commit
ec38e6ef16
19 files changed
+594
-226
No files matched your search
@@ -42,6 +42,30 @@ import {
|
||||
setScopeMaskFeather,
|
||||
} from './scopeMask.js';
|
||||
import { ShareLinkManager } from './sharelink.js';
|
||||
import { createFakeEngine } from './globe/testing/fakeEngine.js';
|
||||
/**
|
||||
* A globe engine standing in for the viewer double this test used to build:
|
||||
* the camera pose comes from `camera.positionCartographic`/heading/pitch/roll,
|
||||
* and `camera.flyTo`/`setView` and `scene.requestRender` replace the engine's.
|
||||
*/
|
||||
function engineViewer({ camera = {}, scene = {} } = {}) {
|
||||
const engine = createFakeEngine();
|
||||
const carto = camera.positionCartographic;
|
||||
if (carto)
|
||||
engine.fake.setPose({
|
||||
longitude: carto.longitude,
|
||||
latitude: carto.latitude,
|
||||
height: carto.height,
|
||||
heading: camera.heading ?? 0,
|
||||
pitch: camera.pitch ?? -Math.PI / 2,
|
||||
roll: camera.roll ?? 0,
|
||||
});
|
||||
if (camera.flyTo) engine.camera.flyTo = camera.flyTo;
|
||||
if (camera.setView) engine.camera.setView = camera.setView;
|
||||
if (scene.requestRender) engine.render.request = () => scene.requestRender();
|
||||
return engine;
|
||||
}
|
||||
|
||||
|
||||
// Follow the UI wiring and its extracted preset definitions.
|
||||
const uiSource = readShellSource()
|
||||
@@ -71,7 +95,7 @@ function managerForHash(hash) {
|
||||
roll: 0,
|
||||
},
|
||||
};
|
||||
return new ShareLinkManager(viewer);
|
||||
return new ShareLinkManager(engineViewer(viewer));
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
Reference in new issue
Block a user