feat(ui): switch between Cesium and Navara in Visual Presets

Remember the chosen engine and restore the current view after navigation. Keep the standalone JavaScript UI and retire the Dioxus migration and Cesium removal milestones.
This commit is contained in:
German Khokhlov committed 2026-11-02 11:29:55 +04:00
1 parent dc7a7c4d53
commit 1da65dc264
7 files changed
+171 -1

No files matched your search

+6
View File
@@ -522,6 +522,12 @@ export class ShareLinkManager {
}
}
/** Save the current view before leaving the page. */
flush() {
clearTimeout(this._debounceTimer);
this._updateHash();
}
_scheduleUpdate() {
if (this._destroyed || this._initialRestorePending) return;
clearTimeout(this._debounceTimer);
+33 -1
View File
@@ -1,8 +1,40 @@
import { createApplicationControls } from '../app/controls.js';
import { getStandaloneCatalog } from './catalog.js';
import { ENGINE_STORAGE_KEY } from '../app/engineChoice.js';
export function createStandaloneControls(options) {
return createApplicationControls({
const controls = createApplicationControls({
catalog: options?.catalog ?? getStandaloneCatalog(),
...options,
});
const select = document.getElementById('globe-engine');
const container = document.getElementById('globe-engine-control');
if (select && container) {
const current = options.scene.engine.kind;
select.value = current;
const switchEngine = () => {
const next = select.value;
if (next === current || !['cesium', 'navara'].includes(next)) return;
controls.styleManager.shareLinkManager.flush();
const url = new URL(window.location.href);
// Keep Back meaningful even when this visit began without ?engine=.
url.searchParams.set('engine', current);
window.history.replaceState(window.history.state, '', url);
url.searchParams.set('engine', next);
try {
window.localStorage.setItem(ENGINE_STORAGE_KEY, next);
} catch {
// The explicit URL also works when storage is blocked.
}
select.value = current;
window.location.assign(url);
};
select.addEventListener('change', switchEngine);
container.hidden = false;
options.defer(() => {
select.removeEventListener('change', switchEngine);
container.hidden = true;
});
}
return controls;
}
+9
View File
@@ -824,6 +824,15 @@
}
/* Map Source tiles live with Visual Presets in the bottom command tray. */
#globe-engine-control label {
gap: 8px;
margin-top: 8px;
}
#globe-engine:focus-visible {
outline: 2px solid currentColor;
}
.map-source-section {
display: grid;
gap: 6px;
+8
View File
@@ -49,6 +49,14 @@
<span class="btn-key">7</span>
</button>
</div>
<div id="globe-engine-control" hidden>
<label class="map-source-heading" for="globe-engine">GLOBE ENGINE
<select class="pp-select" id="globe-engine">
<option value="cesium">Cesium</option>
<option value="navara">Navara</option>
</select>
</label>
</div>
<section class="map-source-section" aria-labelledby="map-source-label">
<div class="map-source-heading">
<span id="map-source-label">MAP SOURCE</span>