From ccb92254b62e890db689f56139b22f2293de3d21 Mon Sep 17 00:00:00 2001 From: rene Date: Sun, 3 May 2026 20:24:14 +0200 Subject: [PATCH] =?UTF-8?q?Fix:=20Routenaufzeichnung=20=E2=80=94=20Stopp-B?= =?UTF-8?q?utton=20braucht=20Long-Press=20(1.8s),=20DIM-Timer=2010s=20?= =?UTF-8?q?=E2=86=92=205s=20(SW=20by-v655)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Verhindert versehentliches Stoppen durch Hosentaschen-Druck: Stopp-Button reagiert nur auf 1.8s Gedrückt-Halten mit Fill-Animation, Einzeltap tut nichts. DIM-Schutz- Overlay greift jetzt nach 5s statt 10s. --- backend/static/index.html | 8 +++--- backend/static/js/app.js | 2 +- backend/static/js/pages/routes.js | 43 ++++++++++++++++++++++++++++--- backend/static/sw.js | 2 +- 4 files changed, 45 insertions(+), 10 deletions(-) diff --git a/backend/static/index.html b/backend/static/index.html index 63a0e9b..59f9fbe 100644 --- a/backend/static/index.html +++ b/backend/static/index.html @@ -93,9 +93,9 @@ - - - + + + @@ -562,7 +562,7 @@ - + diff --git a/backend/static/js/app.js b/backend/static/js/app.js index be0f3c2..f9c8a41 100644 --- a/backend/static/js/app.js +++ b/backend/static/js/app.js @@ -3,7 +3,7 @@ Router, State-Management, Navigation, Initialisierung. ============================================================ */ -const APP_VER = '654'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen +const APP_VER = '655'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen const APP_VERSION = '1.3.0'; // ← semantische Version, wird bei make release gesetzt const IS_STAGING = location.hostname === 'staging.banyaro.app'; diff --git a/backend/static/js/pages/routes.js b/backend/static/js/pages/routes.js index bdc48c1..bac1664 100644 --- a/backend/static/js/pages/routes.js +++ b/backend/static/js/pages/routes.js @@ -696,9 +696,44 @@ window.Page_routes = (() => { _recTrack = []; _recDistKm = 0; _recStartTime = Date.now(); const ctrl = document.getElementById('rk-rec-ctrl'); - ctrl.innerHTML = ``; - ctrl.querySelector('#rk-rec-stopbtn').addEventListener('click', () => _stopRecInOvl(true)); + ctrl.innerHTML = ` + `; + + // Long-Press 1.8s zum Stoppen + let _stopTimer = null, _stopTick = null; + const btn = ctrl.querySelector('#rk-rec-stopbtn'); + const fill = ctrl.querySelector('#rk-stop-fill'); + const startHold = () => { + if (_stopTimer) return; + const DURATION = 1800; + const start = Date.now(); + _stopTick = setInterval(() => { + const p = Math.min((Date.now() - start) / DURATION, 1); + fill.style.transition = 'none'; + fill.style.transform = `scaleX(${p})`; + }, 30); + _stopTimer = setTimeout(() => { + clearInterval(_stopTick); _stopTick = null; _stopTimer = null; + fill.style.transform = 'scaleX(1)'; + _stopRecInOvl(true); + }, DURATION); + }; + const cancelHold = () => { + if (!_stopTimer && !_stopTick) return; + clearTimeout(_stopTimer); clearInterval(_stopTick); + _stopTimer = null; _stopTick = null; + fill.style.transition = 'transform 0.25s ease'; + fill.style.transform = 'scaleX(0)'; + }; + btn.addEventListener('pointerdown', e => { e.preventDefault(); startHold(); }); + btn.addEventListener('pointerup', cancelHold); + btn.addEventListener('pointerleave', cancelHold); + btn.addEventListener('pointercancel', cancelHold); document.getElementById('rk-rec-stats-bar').style.display = ''; _recPolyline = L.polyline([], { color: '#ef4444', weight: 5, opacity: 0.9 }).addTo(_recMap); @@ -789,7 +824,7 @@ window.Page_routes = (() => { dim.style.display = 'flex'; _recDimmed = true; } - }, 10000); + }, 5000); } async function _stopRecInOvl(save) { diff --git a/backend/static/sw.js b/backend/static/sw.js index a159edb..a216340 100644 --- a/backend/static/sw.js +++ b/backend/static/sw.js @@ -3,7 +3,7 @@ Offline-Cache + Push Notifications + Tile-Cache ============================================================ */ -const CACHE_VERSION = 'by-v654'; +const CACHE_VERSION = 'by-v655'; const CACHE_STATIC = `${CACHE_VERSION}-static`; const CACHE_TILES = 'ban-yaro-tiles-v1'; // bleibt über SW-Updates erhalten const CACHE_API = 'ban-yaro-api-v1'; // API-Response-Cache