Let the shell's share link, HUD, orbit and navigation follow another globe engine

The shell reads its viewer, engine and map stack from the attached scene. ShareLinkManager, IntelHUD and OrbitController gain attachEngine, NavigationController setScene and LocationNavigation attachScene/detachScene, so a switch can keep them and move only their camera listeners; between engines they write and read nothing. The voice runner and session voice modules are owned by their packages, which check:boundaries needs since the voice commit.
This commit is contained in:
German Khokhlov committed 2026-11-03 17:48:08 +04:00
1 parent 741b6f67eb
commit d1fdb9eb45
9 files changed
+243 -17

No files matched your search

+30 -3
View File
@@ -150,6 +150,28 @@ export class ShareLinkManager {
);
}
/**
* Follow another globe engine's camera (an engine switch), or none (null)
* between two engines. The link's state, listeners and holds stay; a
* restore flight still owned on the outgoing camera is settled.
*/
attachEngine(engine) {
if (this._destroyed) return;
this._removeCameraChanged?.();
this._removeCameraChanged = null;
if (this._activeCameraFlight) {
const flight = this._activeCameraFlight;
this._restoreGeneration += 1;
this._activeCameraFlight = null;
flight.settle?.('superseded');
}
this.engine = engine ? engineFromViewer(engine) : null;
if (!this.engine) return;
this._removeCameraChanged = this.engine.camera.changed.addEventListener(
() => this._scheduleUpdate(),
);
}
/**
* Parse the share this page opened with: the host's `initialShareCode`, a
* `/share/<code>` address, or a long-form hash. Returns the parsed state, or
@@ -364,7 +386,7 @@ export class ShareLinkManager {
state,
{ applyCamera = true, instant = false, navigationToken = null } = {},
) {
if (this._destroyed || !state)
if (this._destroyed || !state || !this.engine)
return { succeeded: false, reason: 'unavailable' };
const view = {
destination: geo.cartesian3.fromDegrees(state.lon, state.lat, state.alt),
@@ -682,7 +704,12 @@ export class ShareLinkManager {
}
_updateHash() {
if (this._destroyed || this._initialRestorePending || this._navigationHeld)
if (
this._destroyed ||
!this.engine ||
this._initialRestorePending ||
this._navigationHeld
)
return;
const params = this._buildHashParams();
if (!params) return;
@@ -703,7 +730,7 @@ export class ShareLinkManager {
/** Build a deterministic snapshot without mutating history. */
_buildHashParams() {
if (this._destroyed) return null;
if (this._destroyed || !this.engine) return null;
const pose = this.engine.camera.pose();
const carto = pose.cartographic;
if (!carto) return null;