auto-sync: 2026-05-05 22:40:01

This commit is contained in:
Stream
2026-05-05 22:40:01 +03:00
parent d86fc267f8
commit 60fd17f88f
2 changed files with 21 additions and 3 deletions

View File

@@ -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;

View File

@@ -534,6 +534,19 @@ function waypointPinSvg(label, color) {
</svg>`;
}
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 `<div class="wl-item" id="wl-item-${i}" data-idx="${i}">
<div class="wl-pin">${waypointPinSvg(label, color)}</div>
<span class="wl-label" id="wl-label-${i}">${coordText}</span>
<div class="wl-info">
<span class="wl-label" id="wl-label-${i}">${coordText}</span>
${distStr ? `<span class="wl-dist">${distStr}</span>` : ''}
</div>
<div class="wl-drag-handle" data-idx="${i}">${gripSvg}</div>
<button class="wl-remove" onclick="removeWaypoint(${i})" title="Удалить">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M18 6 6 18M6 6l12 12"/></svg>