]> git.openstreetmap.org Git - rails.git/commitdiff
Move getDistText next to other formatting functions
authorAnton Khorev <tony29@yandex.ru>
Sun, 9 Mar 2025 13:13:51 +0000 (16:13 +0300)
committerAnton Khorev <tony29@yandex.ru>
Sun, 9 Mar 2025 14:16:05 +0000 (17:16 +0300)
app/assets/javascripts/index/directions.js

index a2b383ba0cd5924de0db16edc013eca67cd092dd..044d73baadd8666e0b841f0e0804024c203e720d 100644 (file)
@@ -80,6 +80,14 @@ OSM.Directions = function (map) {
     }
   }
 
+  function getDistText(dist) {
+    if (dist < 5) return "";
+    if (dist < 200) return String(Math.round(dist / 10) * 10) + "m";
+    if (dist < 1500) return String(Math.round(dist / 100) * 100) + "m";
+    if (dist < 5000) return String(Math.round(dist / 100) / 10) + "km";
+    return String(Math.round(dist / 1000)) + "km";
+  }
+
   function formatHeight(m) {
     return I18n.t("javascripts.directions.distance_m", { distance: Math.round(m) });
   }
@@ -221,14 +229,6 @@ OSM.Directions = function (map) {
     }).finally(function () {
       controller = null;
     });
-
-    function getDistText(dist) {
-      if (dist < 5) return "";
-      if (dist < 200) return String(Math.round(dist / 10) * 10) + "m";
-      if (dist < 1500) return String(Math.round(dist / 100) * 100) + "m";
-      if (dist < 5000) return String(Math.round(dist / 100) / 10) + "km";
-      return String(Math.round(dist / 1000)) + "km";
-    }
   }
 
   function hideRoute(e) {