From 35581deab486dc908590f46a09dc0aeec46d0081 Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Sun, 9 Mar 2025 16:29:22 +0300 Subject: [PATCH] Return to a previous structure of getDistText Undoes part of a3c45f6ed66862ee394e2a207dedf400acef9b07 to make getDistText similar to formatDistance. --- app/assets/javascripts/index/directions.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) 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) { -- 2.39.5