From 60fd17f88f6006ea80c233cf20fca440a881a3d7 Mon Sep 17 00:00:00 2001 From: Stream Date: Tue, 5 May 2026 22:40:01 +0300 Subject: [PATCH] auto-sync: 2026-05-05 22:40:01 --- tasks/enduro-trails/prototype/static/app.css | 5 +++-- tasks/enduro-trails/prototype/static/app.js | 19 ++++++++++++++++++- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/tasks/enduro-trails/prototype/static/app.css b/tasks/enduro-trails/prototype/static/app.css index b060ea1..119ec92 100644 --- a/tasks/enduro-trails/prototype/static/app.css +++ b/tasks/enduro-trails/prototype/static/app.css @@ -285,11 +285,12 @@ body.has-map-mode #sheet-backdrop.visible { pointer-events: none; } .wl-item.drag-over-top { border-top: 2px solid var(--accent); } .wl-item.drag-over-bottom { border-bottom: 2px solid var(--accent); } .wl-pin { flex-shrink: 0; display: flex; align-items: center; } +.wl-info { display: flex; flex-direction: column; flex: 1; min-width: 0; } .wl-label { - flex: 1; font-size: 13px; color: var(--text); + font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; - min-width: 0; } +.wl-dist { font-size: 11px; color: var(--text3); margin-top: 1px; } .wl-remove { width: 28px; height: 28px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; diff --git a/tasks/enduro-trails/prototype/static/app.js b/tasks/enduro-trails/prototype/static/app.js index 6b7fd5a..0395439 100644 --- a/tasks/enduro-trails/prototype/static/app.js +++ b/tasks/enduro-trails/prototype/static/app.js @@ -534,6 +534,19 @@ function waypointPinSvg(label, color) { `; } +function haversineM(a, b) { + const R = 6371000; + const dLat = (b.lat - a.lat) * Math.PI / 180; + const dLon = (b.lon - a.lon) * Math.PI / 180; + const s = Math.sin(dLat/2)**2 + Math.cos(a.lat*Math.PI/180) * Math.cos(b.lat*Math.PI/180) * Math.sin(dLon/2)**2; + return R * 2 * Math.atan2(Math.sqrt(s), Math.sqrt(1-s)); +} + +function formatSegmentDist(m) { + if (m < 1000) return Math.round(m) + ' м'; + return (m / 1000).toFixed(1).replace('.', ',') + ' км'; +} + async function renderWaypointsList() { const list = document.getElementById('waypoints-list'); if (!routeWaypoints.length) { list.innerHTML = ''; return; } @@ -546,9 +559,13 @@ async function renderWaypointsList() { const label = isStart ? 'S' : isEnd ? 'F' : String(i); const color = isStart ? '#2EA043' : isEnd ? '#FF3B1F' : '#0066ff'; const coordText = `${wp.lat.toFixed(3)}, ${wp.lon.toFixed(3)}`; + const distStr = i > 0 ? formatSegmentDist(haversineM(routeWaypoints[i-1], wp)) : ''; return `
${waypointPinSvg(label, color)}
- ${coordText} +
+ ${coordText} + ${distStr ? `${distStr}` : ''} +
${gripSvg}