Terrain closes by itself again: the road's surface only off the route (back on it the last road's stayed, so the view never closed); while it's open the top row's Limit shows the surface. Navigated, the planned route behind the car thin and dashed under the trip log's track (the line and its casing clear there). The scale back over the map, bottom left. CAN recordings older than CAN_REC_KEEP_HOURS (24 by default, 0 keeps all) deleted when listed and every segment while recording. TODO tidied
CI / check (push) Successful in 23s
CI / deploy (push) Successful in 2m41s

This commit is contained in:
randy committed 2026-12-03 13:52:13 +01:00
1 parent 21ad6c0c21
commit f981b80599
9 files changed
+80 -34

No files matched your search

-5
View File
@@ -3766,11 +3766,6 @@ html.driving .drive-panel { grid-area: var(--drive-menu, 2 / 10 / 10 / 17); }
overflow: hidden;
}
.statusbar__scale .maplibregl-ctrl-scale {
margin: 0;
font-size: 11px;
}
.statusbar__rev {
margin-left: auto;
}
+3 -1
View File
@@ -414,8 +414,10 @@ export class DashboardControl {
// ({ deg, live }), the road's surface (off a route, /api/road), the CAN
// actions, and the km along the route (null off it).
state() {
const onRoute = this._route && this._offFixes < OFF_ROUTE_FIXES;
// the road's surface only off the route: back on it the last road's would stay (the terrain view never closed)
return { values: this._values, nav: this._nav, heading: this._heading(), simulated: !!this._simRunning, actions: this._actions || [],
surface: this._road?.surface ?? null, course: this._course, atKm: this._route && this._offFixes < OFF_ROUTE_FIXES ? this._lastAt : null };
surface: onRoute ? null : this._road?.surface ?? null, course: this._course, atKm: onRoute ? this._lastAt : null };
}
// Driving, the GNSS course; standing, the compass — else the last of either, not live.
+8 -3
View File
@@ -43,11 +43,13 @@ const NOT_YET = new Set();
// TILT_DEG for TILT_S; back to the road view after PAVED_BACK_M on paved road.
// Closed by hand while still off-road: not again until back on the road.
const UNPAVED = new Set(["compacted", "dirt", "gravel", "path", "impassable"]);
// Valhalla's surfaces, shown in place of the limit while the terrain view is open
const SURFACES = { paved_smooth: "Paved", paved: "Paved", paved_rough: "Rough", compacted: "Compacted", dirt: "Dirt", gravel: "Gravel", path: "Track", impassable: "Impassable" };
const TILT_DEG = 10;
const TILT_S = 10;
const PAVED_BACK_M = 2000;
const TERRAIN_AUTO_KEY = "maptool.terrainAuto";
const FIELDS = { speed: "Speed", limit: "Limit", altitude: "Altitude", time: "Time", sun: "Sun", nextStop: "Next stop",
const FIELDS = { speed: "Speed", limit: "Limit", surface: "Surface", altitude: "Altitude", time: "Time", sun: "Sun", nextStop: "Next stop",
toNextStop: "To next stop", etaNextStop: "ETA next stop", toEnd: "To the end" };
const CARDINALS = ["N", "NE", "E", "SE", "S", "SW", "W", "NW"];
@@ -422,6 +424,8 @@ export function setupDriving(map, nightButton, routePanel, gpxPanel) {
const next = nav?.next ? `· ${typeof nav.next.limit === "number" ? nav.next.limit : "∞"} in ${distance(nav.next.m)}` : "";
return [typeof limit === "number" ? limit : limit === "unlimited" ? "∞" : "—", next, "drive-cell--limit"];
}
case "surface":
return [SURFACES[dash?.surface] || "—", dash?.surface ? "" : "unknown", UNPAVED.has(dash?.surface) ? "drive-terrain--caution" : ""];
case "altitude":
return [v.alt == null ? "—" : Math.round(v.alt), "m"];
case "time":
@@ -490,8 +494,9 @@ export function setupDriving(map, nightButton, routePanel, gpxPanel) {
const a = ahead();
for (const { cell, el } of cells) {
if (cell.widget === "field") {
const [value, unit, cls = ""] = fieldValue(cell.value, a);
el.innerHTML = `<span class="drive-cell__label">${FIELDS[cell.value] || cell.value}</span><span class="drive-cell__value ${cls}">${escapeHtml(value)} <small>${escapeHtml(unit)}</small></span>`;
const name = cell.value === "limit" && openPanel === terrain.el ? "surface" : cell.value; // off-road the surface matters, not the limit
const [value, unit, cls = ""] = fieldValue(name, a);
el.innerHTML = `<span class="drive-cell__label">${FIELDS[name] || name}</span><span class="drive-cell__value ${cls}">${escapeHtml(value)} <small>${escapeHtml(unit)}</small></span>`;
} else if (cell.widget === "maneuver") renderManeuver(el);
else if (cell.widget === "status") {
el.innerHTML = `<b class="drive-status__brand">MAPTOOL</b><span class="drive-cell__muted"><span class="${navigator.onLine ? "drive-status--ok" : ""}">●</span> ${navigator.onLine ? "online" : "offline"}${log?.active ? ` · <span class="drive-status--rec">● rec</span>` : ""}</span>`;
+2 -2
View File
@@ -306,7 +306,7 @@ map.addControl(new HomeButton({ bounds: SLOVAKIA_BOUNDS }), "top-right");
}
// The status bar: the map's center (click to copy), the point under the
// mouse, the zoom level, the scale.
// mouse, the zoom level.
const cursorLabel = document.querySelector(".statusbar__cursor");
let terrainOffline = false; // set once /api/terrain-tiles answers (below)
let elevationTimer = null;
@@ -325,7 +325,7 @@ const zoomLabel = document.querySelector(".statusbar__zoom");
const updateZoom = () => (zoomLabel.textContent = `Zoom ${map.getZoom().toFixed(1)}`);
updateZoom();
map.on("zoom", updateZoom);
document.querySelector(".statusbar__scale").appendChild(new ScaleControl({ unit: "metric" }).onAdd(map));
map.addControl(new ScaleControl({ unit: "metric" }), "bottom-left"); // over the map, as in the canvas' Desktop
// A small inset map showing where the current view sits in context — NPS's
// own overview plugin (docs/nps-resources.adoc's "overview" entry, still on
+21 -8
View File
@@ -610,6 +610,15 @@ export class RoutePanelControl {
return;
}
this._map.addSource(SOURCE, { type: "geojson", data, lineMetrics: true }); // line-progress for _showProgress
// the part behind while navigated: thin and dashed, under the line, which goes clear there (_showProgress)
this._map.addLayer({
id: `${SOURCE}-behind`,
type: "line",
source: SOURCE,
filter: ["==", ["geometry-type"], "LineString"],
layout: { "line-join": "round", visibility: "none" },
paint: { "line-color": getComputedStyle(document.documentElement).getPropertyValue("--ui-muted").trim() || "#6b6b66", "line-width": 2.5, "line-dasharray": [2, 2] },
});
this._map.addLayer({
id: `${SOURCE}-casing`,
type: "line",
@@ -634,21 +643,25 @@ export class RoutePanelControl {
});
}
// Navigated (km along the route, docs/design.adoc): the driven part
// dimmed, the rest magenta (--route-active); null: the planned blue.
// Navigated (km along the route, docs/design.adoc): the part behind thin
// and dashed, the rest magenta (--route-active); null: the planned blue.
_showProgress(km) {
if (!this._map.getLayer(`${SOURCE}-line`)) return;
const total = this._route?.properties.distance_km;
if (km == null || !total) {
const navigated = km != null && !!total;
this._map.setLayoutProperty(`${SOURCE}-behind`, "visibility", navigated ? "visible" : "none");
if (!navigated) {
this._map.setPaintProperty(`${SOURCE}-line`, "line-gradient", undefined);
this._map.setPaintProperty(`${SOURCE}-casing`, "line-gradient", undefined);
return;
}
const css = getComputedStyle(document.documentElement);
const active = css.getPropertyValue("--route-active").trim() || "#a21caf";
const driven = css.getPropertyValue("--ui-muted").trim() || "#6b6b66";
const active = getComputedStyle(document.documentElement).getPropertyValue("--route-active").trim() || "#a21caf";
const clear = "rgba(0, 0, 0, 0)";
const fraction = Math.min(1, Math.max(0, km / total));
this._map.setPaintProperty(`${SOURCE}-line`, "line-gradient",
fraction > 0 ? ["step", ["line-progress"], driven, fraction, active] : ["step", ["line-progress"], active, 1, active]);
// behind the car the line and its casing go clear: the dashed layer under them shows, the log's track over it
const ahead = (color) => (fraction > 0 ? ["step", ["line-progress"], clear, fraction, color] : ["step", ["line-progress"], color, 1, color]);
this._map.setPaintProperty(`${SOURCE}-line`, "line-gradient", ahead(active));
this._map.setPaintProperty(`${SOURCE}-casing`, "line-gradient", ahead("#fff"));
}
// A route item in the library ("Routes" folder), keeping its points and