From ac4657ed228a12e7d8311381b06051dea3308831 Mon Sep 17 00:00:00 2001 From: Stream Date: Tue, 5 May 2026 23:30:01 +0300 Subject: [PATCH] auto-sync: 2026-05-05 23:30:01 --- tasks/enduro-trails/prototype/static/app.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tasks/enduro-trails/prototype/static/app.js b/tasks/enduro-trails/prototype/static/app.js index f0b6094..cfcaf6b 100644 --- a/tasks/enduro-trails/prototype/static/app.js +++ b/tasks/enduro-trails/prototype/static/app.js @@ -591,6 +591,13 @@ function getRouteSegmentDistances() { segDists.push(dist); } + // Scale segments so their sum equals route.distance_m exactly + const total = segDists.slice(1).reduce((a, b) => a + b, 0); + if (total > 0 && route.distance_m > 0) { + const scale = route.distance_m / total; + for (let i = 1; i < segDists.length; i++) segDists[i] *= scale; + } + return segDists; } @@ -920,6 +927,7 @@ function selectRoute(idx) { document.querySelectorAll('.route-card').forEach((card, i) => { card.classList.toggle('active', i === idx); }); + renderWaypointsList(); } // ─── Карточки маршрутов ─────────────────────────────────────────── @@ -1935,6 +1943,7 @@ function selectMiniRoute(idx) { } catch(e) {} } updateMiniRouteCard(); + renderWaypointsList(); } // ─── Mini Route Loading Indicator ─────────────────────────────────