[openstreetmap/openstreetmap-website] Add kilometers/miles switch to directions (PR #5915)

Anton Khorev notifications at github.com
Fri Apr 11 11:08:36 UTC 2025


@AntonKhorev commented on this pull request.



>      } else {
-      return OSM.i18n.t("javascripts.directions.distance_km", { distance: Math.round(m / 1000) });
+      const ft = m / ftSize;
+      const mi = m / miSize;
+      if (ft < 1000) {

We have two different m-km boundaries:

1. The first added was for step distances at 1500m in https://github.com/openstreetmap/openstreetmap-website/commit/c6e8775dbab81daf9515fe94fa0ed4c51cab5f3b
2. The second one was for the summary at 1000m in https://github.com/openstreetmap/openstreetmap-website/commit/3ef8024b1d33f0de6227a26967ba78ef85672a94

Why do we need two? I don't know. I'd expect the step one to be lower to have smaller numbers inside the steps table, but no.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5915#discussion_r2039321616
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/pull/5915/review/2759980348 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20250411/59eb2520/attachment.htm>


More information about the rails-dev mailing list