Skip to content

A spy satellite simulator in your browser, except the data is real. Live open source spatial intelligence on a photorealistic 3D globe.

fix(street-level): reconnect the panel once the data manager attaches, so a switch-on opens it

German Khokhlov36b675b9285c
diff --git a/src/ui/applicationShell.js b/src/ui/applicationShell.js
index 9a03482eb..e7b7fe5ee 100644
--- a/src/ui/applicationShell.js
+++ b/src/ui/applicationShell.js
@@ -264,6 +264,7 @@ export class StyleManager extends ShellFacade {
_contextControls: this._contextControls,
_cctvControls: this._cctvControls,
_radioControls: this._radioControls,
+ _streetLevelControls: this._streetLevelControls,
}),
operations: {
_updateTrafficSyncChip: (...args) =>
diff --git a/src/ui/layerBindings.js b/src/ui/layerBindings.js
index 10ceb3c82..ecbcfbce3 100644
--- a/src/ui/layerBindings.js
+++ b/src/ui/layerBindings.js
@@ -55,6 +55,9 @@ export class LayerBindings {
get _radioControls() {
return this.readControls()._radioControls;
}
+ get _streetLevelControls() {
+ return this.readControls()._streetLevelControls;
+ }
observeCamera() {
this._cctvRequestFocusHandler = (event) =>
routeCctvFocusRequest(
@@ -234,6 +237,8 @@ export class LayerBindings {
this._syncContextModeButtons();
this._cctvControls.connect();
this._radioControls.connect();
+ // Its switch-on requests come from the manager, which arrives after it.
+ this._streetLevelControls?.connect();
this._connectDirectionsCamera();
this._connectWeatherCamera();
if (!this._awarenessSelectedHandler) {
diff --git a/src/ui/shellLifetime.test.mjs b/src/ui/shellLifetime.test.mjs
index 4d34e4271..343c1c904 100644
--- a/src/ui/shellLifetime.test.mjs
+++ b/src/ui/shellLifetime.test.mjs
@@ -80,6 +80,7 @@ function bindings(t) {
hud: { attachDataManager() {} },
_contextControls: { connect() {} },
_cctvControls: { connect() {} }, _radioControls: { connect() {} },
+ _streetLevelControls: { connects: 0, connect() { this.connects += 1; } },
};
const owner = new LayerBindings({
viewer: {}, services: {}, readControls: () => controls,
@@ -97,7 +98,7 @@ function bindings(t) {
subscribe() { events.push([id, 'subscribe']); return () => events.push([id, 'unsubscribe']); },
};
}
- return { owner, manager, events };
+ return { owner, manager, events, controls };
}
test('manager replacement releases Directions even when the new manager has no route layer', (t) => {
@@ -116,6 +117,13 @@ test('manager replacement releases Directions even when the new manager has no r
assert.equal(events.length, count);
});
+test('attaching the manager reconnects Street Level, so its switch-on requests reach the panel', (t) => {
+ const { owner, manager, controls } = bindings(t);
+ owner.attachDataManager(manager('first'));
+ assert.equal(controls._streetLevelControls.connects, 1);
+ owner.stop(); owner.disconnect();
+});
+
test('camera-entry listeners are removed before any asynchronous layer cleanup', (t) => {
const { owner } = bindings(t);
let changes = 0;