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

+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