From: Anton Khorev Date: Sun, 9 Mar 2025 13:29:22 +0000 (+0300) Subject: Return to a previous structure of getDistText X-Git-Tag: live~12^2~2 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/35581deab486dc908590f46a09dc0aeec46d0081?hp=0925d30b5c1885ab2a00b2d0dde083bce57cf2c3 Return to a previous structure of getDistText Undoes part of a3c45f6ed66862ee394e2a207dedf400acef9b07 to make getDistText similar to formatDistance. --- diff --git a/app/assets/javascripts/index/directions.js b/app/assets/javascripts/index/directions.js index 044d73baa..a679d945f 100644 --- a/app/assets/javascripts/index/directions.js +++ b/app/assets/javascripts/index/directions.js @@ -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) {