]> git.openstreetmap.org Git - rails.git/commitdiff
Return to a previous structure of getDistText
authorAnton Khorev <tony29@yandex.ru>
Sun, 9 Mar 2025 13:29:22 +0000 (16:29 +0300)
committerAnton Khorev <tony29@yandex.ru>
Sun, 9 Mar 2025 14:16:05 +0000 (17:16 +0300)
Undoes part of a3c45f6ed66862ee394e2a207dedf400acef9b07 to make getDistText similar to formatDistance.

app/assets/javascripts/index/directions.js

index 044d73baadd8666e0b841f0e0804024c203e720d..a679d945fb2c294daeca4ea2b04d19a5f71b50ef 100644 (file)
@@ -81,11 +81,17 @@ 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";
+    if (dist < 5) {
+      return "";
+    } else if (dist < 200) {
+      return String(Math.round(dist / 10) * 10) + "m";
+    } else if (dist < 1500) {
+      return String(Math.round(dist / 100) * 100) + "m";
+    } else if (dist < 5000) {
+      return String(Math.round(dist / 100) / 10) + "km";
+    } else {
+      return String(Math.round(dist / 1000)) + "km";
+    }
   }
 
   function formatHeight(m) {