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: preserve camera controls when rebuilding the Radio panel

Sameh Khamis1b9ea0e8e3f7
diff --git a/scripts/qa-camera-controls.mjs b/scripts/qa-camera-controls.mjs
index 78ec1650e..7eb2aeca7 100644
--- a/scripts/qa-camera-controls.mjs
+++ b/scripts/qa-camera-controls.mjs
@@ -378,6 +378,22 @@ try {
return rect.width > 0 && rect.left >= 0 && rect.right <= innerWidth + 1;
}),
);
+ check(
+ 'rebuilding Radio preserves the active camera controller and subscription',
+ await page.evaluate(() => {
+ const ui = window.__godsEyeView.styleManager;
+ const camera = ui._cctvControls;
+ const cameraId = camera.getState()?.activeCameraId;
+ ui._initRadioPanel();
+ ui._radioControls.connect();
+ return (
+ ui._cctvControls === camera &&
+ !camera.destroyed &&
+ Boolean(camera._cctvUnsubscribe) &&
+ camera.getState()?.activeCameraId === cameraId
+ );
+ }),
+ );
await page.evaluate(() => window.__godsEyeView.styleManager.dispose());
check(
'CCTV controller is destroyed with the real UI',
diff --git a/src/ui.js b/src/ui.js
index fa0637c2a..844bc3781 100644
--- a/src/ui.js
+++ b/src/ui.js
@@ -4885,7 +4885,6 @@ export class StyleManager {
/** Wire the independent Radio companion controls. */
_initRadioPanel() {
- this._cctvControls?.destroy();
this._radioControls?.destroy();
this._radioControls = new RadioControls({
elements: {