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
This commit is contained in:
1 parent
8c999919b8
commit
12b4ac6725
9 files changed
+199
-19
No files matched your search
+21
-8
@@ -578,7 +578,8 @@ function applyStyle(name) {
|
||||
// switch to), so it's removed entirely rather than left sitting there
|
||||
// offering a choice that can't work.
|
||||
const offlineStatus = document.querySelector(".topbar__offline-status");
|
||||
fetch("/api/offline-tiles")
|
||||
const ready = [];
|
||||
ready.push(fetch("/api/offline-tiles")
|
||||
.then((response) => response.json())
|
||||
.then(({ available }) => {
|
||||
if (available) {
|
||||
@@ -594,25 +595,37 @@ fetch("/api/offline-tiles")
|
||||
// Backend check failed; keep the online style and leave the switch as
|
||||
// is rather than guessing — this is the same-origin request itself
|
||||
// failing, not evidence offline tiles are actually unavailable.
|
||||
});
|
||||
}));
|
||||
|
||||
fetch("/api/terrain-tiles")
|
||||
ready.push(fetch("/api/terrain-tiles")
|
||||
.then((response) => response.json())
|
||||
.then(({ available }) => {
|
||||
overlaysControl.setHillshadeOfflineAvailable(available);
|
||||
overlaysControl.setShadowOfflineAvailable(available);
|
||||
})
|
||||
.catch(() => {});
|
||||
.catch(() => {}));
|
||||
|
||||
fetch("/api/hiking-trails")
|
||||
ready.push(fetch("/api/hiking-trails")
|
||||
.then((response) => response.json())
|
||||
.then(({ countries, bboxes }) => overlaysControl.setHikingTrailsOfflineCountries(countries, bboxes))
|
||||
.catch(() => {});
|
||||
.catch(() => {}));
|
||||
|
||||
fetch("/api/kiwix")
|
||||
ready.push(fetch("/api/kiwix")
|
||||
.then((response) => response.json())
|
||||
.then(({ available }) => overlaysControl.setWikiAvailable(available))
|
||||
.catch(() => {});
|
||||
.catch(() => {}));
|
||||
|
||||
// What was on before the reload / update (localStorage, per device): once
|
||||
// the checks above are in (offline or online terrain, trails, wiki) and the
|
||||
// base map they switched to has loaded.
|
||||
Promise.allSettled(ready).then(() => {
|
||||
const restore = () => {
|
||||
overlaysControl.restore();
|
||||
gpxPanel.restore();
|
||||
};
|
||||
if (map.loaded()) restore();
|
||||
else map.once("idle", restore);
|
||||
});
|
||||
|
||||
// Alt+click, right click or a long press (touch browsers fire
|
||||
// contextmenu for it) anywhere shows every rendered feature at that point — base map
|
||||
|
||||
Reference in new issue
Block a user