Tracker and ITS-G5 as separate overlays, Overlays grouped by category: the tracker gets a name/icon/color, charging from its USB power topic, a floating info card (per-device opacity), a trail of the last 1–24 h and optional position logging that survives restarts (LiveStore); hiking trails keep their main checkbox as an all-countries toggle
This commit is contained in:
1 parent
3fc8c75c60
commit
0e5f79f8e4
9 files changed
+801
-205
No files matched your search
+23
-21
@@ -6,7 +6,7 @@ import { RadarControl } from "/js/radar.js";
|
||||
import { ShadowControl } from "/js/shadow.js";
|
||||
import { ContourControl } from "/js/contour.js";
|
||||
import { HikingTrailsControl } from "/js/hiking_trails.js";
|
||||
import { LiveControl } from "/js/live.js";
|
||||
import { TrackerControl, ItsControl } from "/js/live.js";
|
||||
import { NpsControl } from "/js/nps.js";
|
||||
|
||||
const ICON_IMAGE_SIZE = 48; // rasterized once at this size, rendered much smaller by icon-size below
|
||||
@@ -188,7 +188,8 @@ export class OverlaysControl {
|
||||
this._shadow = new ShadowControl(map);
|
||||
this._contour = new ContourControl(map);
|
||||
this._hikingTrails = new HikingTrailsControl(map);
|
||||
this._live = new LiveControl(map);
|
||||
this._tracker = new TrackerControl(map);
|
||||
this._its = new ItsControl(map);
|
||||
this._nps = new NpsControl(map);
|
||||
this._wikiEnabled = false; // the checkbox's own state
|
||||
this._wikiMoveHandler = null; // the moveend listener driving its live refetch, while enabled
|
||||
@@ -216,26 +217,27 @@ export class OverlaysControl {
|
||||
.querySelector(".basemap-panel__close")
|
||||
.addEventListener("click", () => this._togglePanel(false));
|
||||
|
||||
// Items grouped under a heading each; [heading, [[mount, expandable]]].
|
||||
const groups = [
|
||||
["Terrain", [[(li) => this._hillshade.mount(li)], [(li) => this._shadow.mount(li), true], [(li) => this._contour.mount(li)]]],
|
||||
["Weather", [[(li) => this._radar.mount(li), true]]],
|
||||
["Places & trails", [[(li) => this._hikingTrails.mount(li), true], [(li) => this._mountWiki(li)], [(li) => this._nps.mount(li)]]],
|
||||
["Live", [[(li) => this._tracker.mount(li)], [(li) => this._its.mount(li)]]],
|
||||
];
|
||||
const list = this._panel.querySelector(".overlays-panel__list");
|
||||
list.innerHTML = `
|
||||
<li class="overlays-panel__item"></li>
|
||||
<li class="overlays-panel__item"></li>
|
||||
<li class="overlays-panel__item overlays-panel__item--expandable"></li>
|
||||
<li class="overlays-panel__item overlays-panel__item--expandable"></li>
|
||||
<li class="overlays-panel__item"></li>
|
||||
<li class="overlays-panel__item overlays-panel__item--expandable"></li>
|
||||
<li class="overlays-panel__item"></li>
|
||||
<li class="overlays-panel__item"></li>
|
||||
`;
|
||||
const [hillshadeItem, wikiItem, radarItem, shadowItem, contourItem, hikingTrailsItem, liveItem, npsItem] = list.children;
|
||||
this._hillshade.mount(hillshadeItem);
|
||||
this._mountWiki(wikiItem);
|
||||
this._radar.mount(radarItem);
|
||||
this._shadow.mount(shadowItem);
|
||||
this._contour.mount(contourItem);
|
||||
this._hikingTrails.mount(hikingTrailsItem);
|
||||
this._live.mount(liveItem);
|
||||
this._nps.mount(npsItem);
|
||||
list.innerHTML = "";
|
||||
for (const [heading, items] of groups) {
|
||||
const head = document.createElement("li");
|
||||
head.className = "overlays-panel__group";
|
||||
head.textContent = heading;
|
||||
list.appendChild(head);
|
||||
for (const [mount, expandable] of items) {
|
||||
const li = document.createElement("li");
|
||||
li.className = `overlays-panel__item${expandable ? " overlays-panel__item--expandable" : ""}`;
|
||||
list.appendChild(li);
|
||||
mount(li);
|
||||
}
|
||||
}
|
||||
|
||||
onlyOneSidePanelOpen(this._panel, () => this._icon.classList.remove("active"));
|
||||
|
||||
|
||||
Reference in new issue
Block a user