Dashboard: altitude (gnss.alt, the terrain's while simulating), the car tilted by the terrain's slope while simulating; free look while following (the map moved by hand pauses the follow, "Back to the position" or 15 s resumes it); overlays and shown library files remembered per device (localStorage), back after a reload once the offline checks are in
CI / check (push) Successful in 24s
CI / deploy (push) Successful in 17s

This commit is contained in:
randy committed 2026-12-01 00:15:08 +01:00
1 parent 8c999919b8
commit 12b4ac6725
9 files changed
+199 -19

No files matched your search

+32
View File
@@ -189,6 +189,12 @@ class HillshadeControl {
// here since neither has anything to "manage," just on/off (Radar's own
// scrub/forecast controls live behind expanding its item, not a factor in
// where it's mounted).
const OVERLAYS_ON_KEY = "overlaysOn";
function readOn() {
try { return JSON.parse(localStorage.getItem(OVERLAYS_ON_KEY)) || {}; } catch { return {}; }
}
export class OverlaysControl {
constructor(map) {
this._map = map;
@@ -246,6 +252,7 @@ export class OverlaysControl {
li.className = `overlays-panel__item${expandable ? " overlays-panel__item--expandable" : ""}`;
list.appendChild(li);
mount(li);
this._remember(li, `${heading}/${li.querySelector(".overlays-panel__name, label")?.textContent.trim()}`);
}
}
@@ -254,6 +261,31 @@ export class OverlaysControl {
sidebar.appendChild(this._container);
}
// Which overlays are on, per device (localStorage), so a reload or an
// update doesn't switch them all off: saved on every change, turned back
// on by restore() — once map.js knows what's available offline.
_remember(li, key) {
const toggle = li.querySelector(".overlays-panel__toggle");
if (!toggle) return;
(this._toggles ??= []).push([key, toggle, li]);
toggle.addEventListener("change", () => {
const on = readOn();
if (toggle.checked) on[key] = true;
else delete on[key];
try { localStorage.setItem(OVERLAYS_ON_KEY, JSON.stringify(on)); } catch { /* private window: not kept */ }
});
}
restore() {
const on = readOn();
for (const [key, toggle, li] of this._toggles ?? []) {
const hidden = toggle.closest("[hidden]"); // within the item: not for this login (the closed panel doesn't count)
if (!on[key] || toggle.checked || toggle.disabled || (hidden && li.contains(hidden))) continue;
toggle.checked = true;
toggle.dispatchEvent(new Event("change"));
}
}
_togglePanel(force) {
const open = force === undefined ? this._panel.hidden : force;
this._panel.hidden = !open;