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 ─────────────────────────────────