From 0925d30b5c1885ab2a00b2d0dde083bce57cf2c3 Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Sun, 9 Mar 2025 16:13:51 +0300 Subject: [PATCH] Move getDistText next to other formatting functions --- app/assets/javascripts/index/directions.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) 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) { -- 2.39.5