From c0474ffdc5d8cbd38f7a7d8340f1c3f2f985ac41 Mon Sep 17 00:00:00 2001 From: Stream Date: Wed, 6 May 2026 11:40:01 +0300 Subject: [PATCH] auto-sync: 2026-05-06 11:40:01 --- tasks/enduro-trails/prototype/static/app.js | 46 +++++++++++++++++-- .../enduro-trails/prototype/static/index.html | 8 ++-- 2 files changed, 46 insertions(+), 8 deletions(-) diff --git a/tasks/enduro-trails/prototype/static/app.js b/tasks/enduro-trails/prototype/static/app.js index ddafdb3..c83953a 100644 --- a/tasks/enduro-trails/prototype/static/app.js +++ b/tasks/enduro-trails/prototype/static/app.js @@ -456,10 +456,37 @@ function addWaypointMode() { window._map.getCanvas().style.cursor = 'crosshair'; // Hide main sheet so the map is visible for tapping closeSheet('sheet-route'); - // Show hint in mini-bar - const statsEl = document.getElementById('mini-stats'); - if (statsEl) statsEl.textContent = 'Тапни на карте для добавления точки'; + // Show onboarding mini-bar for "add waypoint" mode + _showMiniOnboardWaypoint(); +} + +function _showMiniOnboardWaypoint() { + // Reuse mini-onboard UI with "add waypoint" hint + const idx = routeWaypoints.length; // next waypoint index + const label = String(idx); + const color = '#0066ff'; + const hint = 'Тапни на карте — добавить точку'; + + document.getElementById('mini-onboard').style.display = 'flex'; + document.getElementById('mini-dot').style.display = 'none'; + document.getElementById('mini-label').style.display = 'none'; + document.getElementById('mini-stats').style.display = 'none'; + document.getElementById('mini-wheel').style.display = 'none'; + const arrows = document.querySelector('.mini-route-arrows'); + if (arrows) arrows.style.display = 'none'; + const addBtn = document.getElementById('mini-add-btn'); + if (addBtn) addBtn.style.display = 'none'; + + document.getElementById('mini-onboard-pin').innerHTML = waypointPinSvg(label, color); + document.getElementById('mini-onboard-hint').textContent = hint; + document.getElementById('sheet-route-mini').classList.add('visible'); + const ctrl = document.getElementById('map-controls-r'); + if (ctrl) ctrl.style.bottom = '148px'; + + // Search button + const searchBtn = document.getElementById('mini-onboard-search-btn'); + searchBtn.onclick = () => toggleMiniOnboardSearch('waypoint'); } // ─── Маркеры точек ───────────────────────────────────────────────── @@ -1478,6 +1505,7 @@ function initRouteClicks(map) { } else { routeWaypoints.push({ lon: lng, lat: lat }); } + hideMiniOnboard(); rebuildWaypointMarkers(); renderWaypointsList(); if (routeWaypoints.length >= 2) debounceBuildRoute(); updateMiniRouteCard(); @@ -2425,8 +2453,16 @@ function _selectMiniOnboardResult(type, lat, lon, name) { const wp = { lat: parseFloat(lat), lon: parseFloat(lon) }; if (type === 'start') { routeWaypoints.unshift(wp); - } else { + } else if (type === 'finish') { routeWaypoints.push(wp); + } else if (type === 'waypoint') { + // Insert before last waypoint (same as addingWaypoint tap logic) + if (routeWaypoints.length >= 2) { + routeWaypoints.splice(routeWaypoints.length - 1, 0, wp); + } else { + routeWaypoints.push(wp); + } + addingWaypoint = false; } document.getElementById('mini-onboard-search-panel').style.display = 'none'; rebuildWaypointMarkers(); @@ -2436,7 +2472,7 @@ function _selectMiniOnboardResult(type, lat, lon, name) { hideMiniOnboard(); debounceBuildRoute(); } else { - showRouteOnboardingMini(); // update to finish prompt + showRouteOnboardingMini(); // switch to finish } updateMiniRouteCard(); } diff --git a/tasks/enduro-trails/prototype/static/index.html b/tasks/enduro-trails/prototype/static/index.html index dbbaaa0..67e993b 100644 --- a/tasks/enduro-trails/prototype/static/index.html +++ b/tasks/enduro-trails/prototype/static/index.html @@ -68,9 +68,11 @@ - -