mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +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
+13
-14
@@ -3,10 +3,15 @@ import { stampInitialShareGesture } from '../navigationPolicy.js';
|
||||
import { canPresentDeferredStatusNotice } from '../loadingFeedback.js';
|
||||
import { UiLifetime } from './uiLifetime.js';
|
||||
|
||||
/** Own initial share restoration, durable layer state and restoration notices. */
|
||||
/**
|
||||
* Own initial share restoration, durable layer state and restoration notices.
|
||||
* `canvas` (the globe engine's) receives the first-gesture listeners; it
|
||||
* defaults to the viewer's.
|
||||
*/
|
||||
export class ShareRestoration {
|
||||
constructor({
|
||||
viewer,
|
||||
canvas = viewer?.canvas,
|
||||
navigation,
|
||||
syncShareState,
|
||||
syncModels3d,
|
||||
@@ -16,6 +21,7 @@ export class ShareRestoration {
|
||||
}) {
|
||||
Object.assign(this, {
|
||||
viewer,
|
||||
canvas,
|
||||
navigation,
|
||||
syncShareState,
|
||||
syncModels3d,
|
||||
@@ -114,20 +120,16 @@ export class ShareRestoration {
|
||||
this.navigation._stampNavigation(options),
|
||||
);
|
||||
};
|
||||
this.viewer?.canvas?.addEventListener(
|
||||
this.canvas?.addEventListener(
|
||||
'pointerdown',
|
||||
this._initialShareGestureHandler,
|
||||
{
|
||||
passive: true,
|
||||
},
|
||||
);
|
||||
this.viewer?.canvas?.addEventListener(
|
||||
'wheel',
|
||||
this._initialShareGestureHandler,
|
||||
{
|
||||
passive: true,
|
||||
},
|
||||
);
|
||||
this.canvas?.addEventListener('wheel', this._initialShareGestureHandler, {
|
||||
passive: true,
|
||||
});
|
||||
}
|
||||
connect(dataManager) {
|
||||
this._dataManager = dataManager;
|
||||
@@ -292,14 +294,11 @@ export class ShareRestoration {
|
||||
share: null,
|
||||
layers: [],
|
||||
});
|
||||
this.viewer?.canvas?.removeEventListener(
|
||||
this.canvas?.removeEventListener(
|
||||
'pointerdown',
|
||||
this._initialShareGestureHandler,
|
||||
);
|
||||
this.viewer?.canvas?.removeEventListener(
|
||||
'wheel',
|
||||
this._initialShareGestureHandler,
|
||||
);
|
||||
this.canvas?.removeEventListener('wheel', this._initialShareGestureHandler);
|
||||
this._initialShareGestureHandler = null;
|
||||
this._lifetime.destroy();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user