Hold the shell's inputs between two engines instead of reaching released controllers

A visual choice made while no globe is attached (a style key, a Display control, a voice command) is queued and applied to the next engine's settings after it restored the address's view, so the person's choice wins; reads answer from the released settings. The globe reset and a location lookup started without a globe do nothing, and the map-source chips and camera buttons are unbound until the next globe binds them.
This commit is contained in:
German Khokhlov committed 2026-11-03 19:54:45 +04:00
1 parent df73c5b21a
commit 40a81c58e6
7 files changed
+193 -5

No files matched your search

+23
View File
@@ -9,6 +9,10 @@ import { VisualSettings } from './visualSettings.js';
import { NavigationController } from './navigationController.js';
import { ShareRestoration } from './shareRestoration.js';
import { DisplayBindings } from './displayBindings.js';
import {
applyPendingVisualChoices,
pendingVisualSettings,
} from './pendingVisualSettings.js';
import { createStateChannel } from '../app/stateChannel.js';
import { UiLifetime } from './uiLifetime.js';
import { RecordingControls } from './recordingControls.js';
@@ -754,6 +758,17 @@ export class StyleManager extends ShellFacade {
this._layerBindings.observeCamera();
this._layoutRightPanels();
this._syncCctvPanelViewport();
// Choices made between the engines apply once this engine restored
// the address's view: the person's choice wins over the link.
const pending = this._pendingVisual?.queue;
this._pendingVisual = null;
if (pending?.length) {
const settings = this._visualSettings;
void this.initialRestorePromise.then(() => {
if (!this._disposed && this._visualSettings === settings)
applyPendingVisualChoices(settings, pending);
});
}
} catch (error) {
void this.detachScene().catch((cleanupError) =>
console.error(
@@ -809,10 +824,18 @@ export class StyleManager extends ShellFacade {
this.celestialRing?.destroy();
this.celestialRing = null;
this._visualSettings.destroy();
// Until the next globe: choices wait for it (pendingVisualSettings.js),
// and the map-source chips and camera buttons answer nothing.
this._pendingVisual = pendingVisualSettings(this._visualSettings);
this._visualSettings = this._pendingVisual.settings;
this._mapSourceControls?.destroy();
this._mapSourceControls = null;
useDisplayStore(applicationPinia()).connectMapSource(null);
this._cameraOrientationControls?.destroy();
this._cameraOrientationControls = null;
if (this._orientationToken)
useGlobeActionsStore(applicationPinia()).detach(this._orientationToken);
this._orientationToken = null;
this._displayBindings.attachViewer(null);
this._locationNavigation.detachScene();
this.hud.attachEngine(null);