diff --git a/tasks/enduro-trails/prototype/static/app.css b/tasks/enduro-trails/prototype/static/app.css index b0505f5..41b22d7 100644 --- a/tasks/enduro-trails/prototype/static/app.css +++ b/tasks/enduro-trails/prototype/static/app.css @@ -73,6 +73,12 @@ html, body { top: max(env(safe-area-inset-top, 0px), 12px); left: 12px; right: 12px; height: 50px; + /* Push MapLibre nav controls below search bar */ +} +.maplibregl-ctrl-top-left { + top: calc(max(env(safe-area-inset-top, 0px), 12px) + 58px) !important; + left: 12px !important; +} background: var(--surface); border: 1px solid var(--border); border-radius: 14px; diff --git a/tasks/enduro-trails/prototype/static/app.js b/tasks/enduro-trails/prototype/static/app.js index 419ee9b..08ebfda 100644 --- a/tasks/enduro-trails/prototype/static/app.js +++ b/tasks/enduro-trails/prototype/static/app.js @@ -201,6 +201,11 @@ function closeSheet(id) { } } +// Close sheet panel but keep the mode active (route stays on map) +function minimizeSheet(id) { + closeSheet(id); +} + function closeAllSheets() { document.querySelectorAll('.bottom-sheet.open').forEach(s => { s.classList.remove('open'); @@ -383,20 +388,29 @@ function getBasePath() { // ─── Режим маршрута ──────────────────────────────────────────────── function toggleRouteMode() { - routeMode = !routeMode; const btn = document.getElementById('tb-route'); + const sheet = document.getElementById('sheet-route'); + if (routeMode) { + // Already in route mode + if (sheet.classList.contains('open')) { + // Sheet is open → close sheet but keep route on map + minimizeSheet('sheet-route'); + } else { + // Sheet already closed → exit route mode entirely (clear route) + routeMode = false; + btn.classList.remove('active'); + clearRoute(); + window._map.getCanvas().style.cursor = ''; + } + } else { + // Enter route mode deactivateAllModes(); routeMode = true; btn.classList.add('active'); openSheet('sheet-route'); clearRoute(); window._map.getCanvas().style.cursor = 'crosshair'; - } else { - btn.classList.remove('active'); - closeSheet('sheet-route'); - clearRoute(); - window._map.getCanvas().style.cursor = ''; } updateMapModeClass(); } @@ -1168,18 +1182,23 @@ let reconCenter = null; let reconRadius = 20; function toggleReconMode() { - reconMode = !reconMode; const btn = document.getElementById('tb-recon'); + const sheet = document.getElementById('sheet-recon'); if (reconMode) { + if (sheet.classList.contains('open')) { + minimizeSheet('sheet-recon'); + } else { + reconMode = false; + btn.classList.remove('active'); + window._map.getCanvas().style.cursor = ''; + clearRecon(); + } + } else { deactivateAllModes(); reconMode = true; btn.classList.add('active'); window._map.getCanvas().style.cursor = 'crosshair'; openSheet('sheet-recon'); - } else { - btn.classList.remove('active'); - window._map.getCanvas().style.cursor = ''; - clearRecon(); } updateMapModeClass(); } @@ -1275,9 +1294,18 @@ let linkPoints = []; let linkMarkers = []; function toggleLinkMode() { - linkMode = !linkMode; const btn = document.getElementById('tb-link'); + const sheet = document.getElementById('sheet-link'); if (linkMode) { + if (sheet.classList.contains('open')) { + minimizeSheet('sheet-link'); + } else { + linkMode = false; + btn.classList.remove('active'); + window._map.getCanvas().style.cursor = ''; + clearLink(); + } + } else { deactivateAllModes(); linkMode = true; btn.classList.add('active'); @@ -1288,10 +1316,6 @@ function toggleLinkMode() { linkPoints = []; linkMarkers.forEach(m => m.remove()); linkMarkers = []; - } else { - btn.classList.remove('active'); - window._map.getCanvas().style.cursor = ''; - clearLink(); } updateMapModeClass(); } @@ -1426,9 +1450,18 @@ let scenicRoutes = []; let activeScenicIdx = 0; function toggleScenicMode() { - scenicMode = !scenicMode; const btn = document.getElementById('tb-scenic'); + const sheet = document.getElementById('sheet-scenic'); if (scenicMode) { + if (sheet.classList.contains('open')) { + minimizeSheet('sheet-scenic'); + } else { + scenicMode = false; + btn.classList.remove('active'); + window._map.getCanvas().style.cursor = ''; + clearScenic(); + } + } else { deactivateAllModes(); scenicMode = true; btn.classList.add('active'); @@ -1436,10 +1469,6 @@ function toggleScenicMode() { openSheet('sheet-scenic'); document.getElementById('scenic-status').textContent = 'Тапни точку старта на карте'; document.getElementById('btn-build-scenic').style.display = 'none'; - } else { - btn.classList.remove('active'); - window._map.getCanvas().style.cursor = ''; - clearScenic(); } updateMapModeClass(); } diff --git a/tasks/enduro-trails/prototype/static/index.html b/tasks/enduro-trails/prototype/static/index.html index 64e868b..491b5ee 100644 --- a/tasks/enduro-trails/prototype/static/index.html +++ b/tasks/enduro-trails/prototype/static/index.html @@ -60,7 +60,7 @@

Маршрут

-
@@ -91,7 +91,7 @@

Разведка

-
@@ -135,7 +135,7 @@

Красивый маршрут

-
@@ -168,7 +168,7 @@

Связка

-