From 42d7f8eb18f772b1e53e77d7593c3a414849a9c7 Mon Sep 17 00:00:00 2001 From: Mathieu Moran Date: Sat, 15 Aug 2026 18:14:21 -0400 Subject: [PATCH] fix: clamp max-speed label at edges + move trip location next to time - placeMaxTick() clamps the label so it stays within the scrubber instead of overlapping the time/speed readouts when max speed is near an edge - give the scrubber row more bottom margin (mb-3) so the tick label clears the readout row below - move the trip location readout directly under the timestamp (left side), removing the separate bottom line --- server/templates/history.html | 8 +++++--- static/js/history.js | 10 ++++++++-- templates/history.html | 8 +++++--- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/server/templates/history.html b/server/templates/history.html index 71f4790..7a31935 100644 --- a/server/templates/history.html +++ b/server/templates/history.html @@ -67,7 +67,7 @@ data-tile-attrib="© OpenStreetMap contributors © CARTO" data-min-zoom="3" data-max-zoom="19"> diff --git a/static/js/history.js b/static/js/history.js index ac88296..c1013e6 100644 --- a/static/js/history.js +++ b/static/js/history.js @@ -168,8 +168,14 @@ } var ratio = st.maxIndex / (st.points.length - 1); var thumb = 16; // approximate range thumb width - var usable = Math.max(1, scrubber.clientWidth - thumb); - tick.style.left = (thumb / 2 + ratio * usable) + "px"; + var w = scrubber.clientWidth; + var usable = Math.max(1, w - thumb); + var x = thumb / 2 + ratio * usable; + // Keep the centered label inside the scrubber so it doesn't overlap the + // time (left) or speed (right) readouts when max speed is at an edge. + var halfLabel = 24; + x = Math.max(halfLabel, Math.min(w - halfLabel, x)); + tick.style.left = x + "px"; tick.hidden = false; } diff --git a/templates/history.html b/templates/history.html index 14cffbe..595a088 100644 --- a/templates/history.html +++ b/templates/history.html @@ -64,7 +64,7 @@