Improve trail planning: option to re-order route anchors (#1007)

* trail anchor list added

* add search location card to extend route endpoint in drawing mode

* add POI popup endpoint action in route drawing mode

* fix anchor stats, improve anchor list entries and refine route marker behavior

* fix map marker spinner

* docs updated

* fix spinner when delete an anchor

* further improvements

* fix adding first anchor from POI

* optimize drag handle area

---------

Co-authored-by: Flomp <Flomp@users.noreply.github.com>
This commit is contained in:
slothful-vassal
2026-06-06 11:56:12 +02:00
committed by GitHub
parent 14ebaa0d04
commit 44cd092065
32 changed files with 1792 additions and 192 deletions

View File

@@ -13,7 +13,10 @@ export function formatTimeHHMM(seconds?: number) {
return (h < 10 ? "0" : "") + h.toString() + "h " + (m < 10 ? "0" : "") + m.toString() + "m";
}
export function formatDistance(meters?: number) {
export function formatDistance(
meters?: number,
options: { compact?: boolean } = {},
) {
if (meters === undefined) {
return "-";
}
@@ -22,7 +25,14 @@ export function formatDistance(meters?: number) {
if (unit == "metric") {
if (meters >= 1000) {
return `${(meters / 1000).toFixed(2)} km`
const kilometers = meters / 1000;
if (options.compact && kilometers >= 100) {
return `${kilometers.toFixed(0)} km`;
}
if (options.compact && kilometers >= 10) {
return `${kilometers.toFixed(1)} km`;
}
return `${kilometers.toFixed(2)} km`
} else {
return meters % 1 == 0 ? `${meters} m` : `${Math.round(meters)} m`;
}
@@ -148,4 +158,4 @@ export function formatHTMLAsText(html?: string) {
// Trim the result
return text.trim();
}
}