fix(directions): show a 9.96 km route as 10 km, not 10.0 km

routeDistanceText picked one decimal while the raw kilometres were under
10, then rounded them for display, so 9.95 km or more read "10.0 km".
It now picks the unit from the rounded tenth, as it already does at the
metre/kilometre boundary.
This commit is contained in:
Aditya committed 2026-10-28 15:16:45 +05:30
1 parent a4d3701c3c
commit 6364817b5b
3 files changed
+7 -2

No files matched your search

+3 -1
View File
@@ -4172,7 +4172,9 @@ animate). Disable clears all state.
At the metre/kilometre boundary, route distance labels use the rounded
ten-metre value to select the unit, switching to kilometres at 995 metres;
a 996-metre leg displays as `1.0 km` rather than `1000 m`.
a 996-metre leg displays as `1.0 km` rather than `1000 m`. Whole kilometres
start where the label would round to 10.0 km, so a 9.96 km route displays as
`10 km` rather than `10.0 km`.
**Keys needed: none.** Directions works on a keyless boot, and the layer is off
until the operator turns it on.