feat: pin the fastest point on the trip replay map (FEAT-16)

When a route loads, add an amber circle + permanent 'Max speed: X km/h'
tooltip at the point with the highest speed. Shared history.js, so it
applies to both the Pi and the server portal.
This commit is contained in:
Mathieu Moran
2026-08-15 17:54:49 -04:00
parent bfc5ee1615
commit 87d63e8f32
2 changed files with 29 additions and 0 deletions
+18
View File
@@ -172,6 +172,24 @@
L.marker(coords[0]).bindPopup("Start").addTo(st.route);
L.marker(coords[coords.length - 1]).bindPopup("End").addTo(st.route);
}
// Pin the fastest point on the route.
var maxPt = null;
for (var i = 0; i < d.points.length; i++) {
if (!maxPt || d.points[i].speed > maxPt.speed) maxPt = d.points[i];
}
if (maxPt && maxPt.speed > 0) {
L.circleMarker([maxPt.latitude, maxPt.longitude], {
radius: 6,
color: "#fff",
weight: 2,
fillColor: "#f6c23e",
fillOpacity: 1,
})
.bindTooltip("Max speed: " + fS(maxPt.speed), {
permanent: true, direction: "top", offset: [0, -8],
})
.addTo(st.route);
}
st.route.addTo(map);
if (sig.aborted) { cleanup(); return; }
if (coords.length > 1) map.fitBounds(st.route.getBounds(), {padding: [24, 24], maxZoom: 15});