From: Anton Khorev Date: Sun, 9 Mar 2025 13:13:51 +0000 (+0300) Subject: Move getDistText next to other formatting functions X-Git-Tag: live~12^2~3 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/0925d30b5c1885ab2a00b2d0dde083bce57cf2c3 Move getDistText next to other formatting functions --- diff --git a/app/assets/javascripts/index/directions.js b/app/assets/javascripts/index/directions.js index a2b383ba0..044d73baa 100644 --- a/app/assets/javascripts/index/directions.js +++ b/app/assets/javascripts/index/directions.js @@ -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) {