Return to a previous structure of getDistText

Undoes part of a3c45f6ed6 to make getDistText similar to formatDistance.
This commit is contained in:
Anton Khorev 2025-03-09 16:29:22 +03:00
parent 0925d30b5c
commit 35581deab4

View file

@ -81,11 +81,17 @@ OSM.Directions = function (map) {
} }
function getDistText(dist) { function getDistText(dist) {
if (dist < 5) return ""; if (dist < 5) {
if (dist < 200) return String(Math.round(dist / 10) * 10) + "m"; return "";
if (dist < 1500) return String(Math.round(dist / 100) * 100) + "m"; } else if (dist < 200) {
if (dist < 5000) return String(Math.round(dist / 100) / 10) + "km"; return String(Math.round(dist / 10) * 10) + "m";
return String(Math.round(dist / 1000)) + "km"; } 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) { function formatHeight(m) {