From 0d976b90b7473f93098ca34f47ae0adb964bd1b2 Mon Sep 17 00:00:00 2001 From: rene Date: Sat, 6 Jun 2026 20:07:23 +0200 Subject: [PATCH] =?UTF-8?q?Karte:=20Bewegungs-Gate=20fuer=20den=20POI-Scan?= =?UTF-8?q?ner=20=E2=80=94=20Follow-Mode=20triggerte=20ihn=20laufend?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rene: aktiviertes Crosshair pannt alle paar Sekunden -> jedes moveend startete den Scan. Scans aus KARTENBEWEGUNG laufen jetzt erst, wenn sich das Zentrum >= 20% der Viewport-Breite bewegt hat oder der Zoom wechselt (bei Z16 ~ alle 100-150m Fussweg). Alle anderen Trigger (Marker gespeichert, Layer-Toggle, Retry, Init, Scan-Queue) ungebremst. Bump v1247 --- VERSION | 2 +- backend/static/index.html | 24 ++++++++++++------------ backend/static/js/app.js | 2 +- backend/static/js/pages/map.js | 33 +++++++++++++++++++++++++++++---- backend/static/landing.html | 2 +- backend/static/sw.js | 2 +- 6 files changed, 45 insertions(+), 20 deletions(-) diff --git a/VERSION b/VERSION index 09c2854..1280674 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1246 \ No newline at end of file +1247 \ No newline at end of file diff --git a/backend/static/index.html b/backend/static/index.html index 61df8dc..3227008 100644 --- a/backend/static/index.html +++ b/backend/static/index.html @@ -86,14 +86,14 @@ Ban Yaro - + - - - - - + + + + + @@ -612,11 +612,11 @@ - - - - - + + + + + @@ -626,7 +626,7 @@ - + diff --git a/backend/static/js/app.js b/backend/static/js/app.js index 2c3fabd..7f96416 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 = '1246'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen +const APP_VER = '1247'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen const APP_VERSION = '1.6.0'; // ← semantische Version, wird bei make release gesetzt window.APP_VER = APP_VER; // global verfügbar für andere Module (z.B. offline-indicator) window.APP_VERSION = APP_VERSION; diff --git a/backend/static/js/pages/map.js b/backend/static/js/pages/map.js index 300c88a..3932710 100644 --- a/backend/static/js/pages/map.js +++ b/backend/static/js/pages/map.js @@ -790,7 +790,7 @@ window.Page_map = (() => { setTimeout(() => _map.invalidateSize(), 600); window.addEventListener('resize', () => _map.invalidateSize()); - _map.on('moveend zoomend', () => { _autoRetryCount = 0; _updateZoomDisplay(); _scheduleOsmLoad(); }); + _map.on('moveend zoomend', () => { _autoRetryCount = 0; _updateZoomDisplay(); _scheduleOsmLoad(true); }); _map.on('dragstart', () => { _followGps = false; _updateFollowBtn(); }); // manuelles Verschieben beendet Follow setTimeout(() => { _updateZoomDisplay(); _scheduleOsmLoad(); }, 800); @@ -996,7 +996,7 @@ window.Page_map = (() => { _scheduleOsmLoad(); }); _map.on('moveend', () => { - _autoRetryCount = 0; _updateZoomDisplay(); _scheduleOsmLoad(); + _autoRetryCount = 0; _updateZoomDisplay(); _scheduleOsmLoad(true); document.getElementById('map-crosshair')?.classList.remove('dragging'); }); _map.on('movestart', () => { @@ -1469,9 +1469,34 @@ window.Page_map = (() => { // ---------------------------------------------------------- // OSM-Layer laden // ---------------------------------------------------------- - function _scheduleOsmLoad() { + // Bewegungs-Gate (René 2026-06-06): Der Follow-Mode pannt alle paar Sekunden → + // jedes moveend triggerte den Scanner LAUFEND. Scans aus Kartenbewegung laufen + // erst, wenn sich das Zentrum ≥ 20 % der Viewport-Breite bewegt hat oder der + // Zoom wechselt. Alle anderen Trigger (Marker gespeichert, Layer-Toggle, Retry, + // Init) scannen weiter ungebremst (fromMove=false). + let _lastScanCenter = null, _lastScanZoom = null; + function _viewChangedEnough() { + try { + const zoom = Math.round(_mapGetZoom()); + if (_lastScanZoom !== zoom) return true; + if (!_lastScanCenter) return true; + const c = _map.getCenter(); + const b = _map.getBounds(); + const viewM = _haversineRec(b.getSouth(), b.getWest(), b.getSouth(), b.getEast()); + const movedM = _haversineRec(_lastScanCenter.lat, _lastScanCenter.lng, c.lat, c.lng); + return movedM >= viewM * 0.2; + } catch (e) { return true; } + } + function _scheduleOsmLoad(fromMove = false) { clearTimeout(_overpassTimer); - _overpassTimer = setTimeout(_loadOsmLayers, 600); + _overpassTimer = setTimeout(() => { + if (fromMove && !_viewChangedEnough()) return; + try { + _lastScanCenter = _map.getCenter(); + _lastScanZoom = Math.round(_mapGetZoom()); + } catch (e) {} + _loadOsmLayers(); + }, 600); } // OSM-Marker-Zählung (ohne eigene Orte), engine-neutral. diff --git a/backend/static/landing.html b/backend/static/landing.html index d93e678..ab4d97c 100644 --- a/backend/static/landing.html +++ b/backend/static/landing.html @@ -4,7 +4,7 @@ - + Ban Yaro — Die Hunde-App für Deutschland, Österreich & Schweiz diff --git a/backend/static/sw.js b/backend/static/sw.js index e4d613e..a86b58c 100644 --- a/backend/static/sw.js +++ b/backend/static/sw.js @@ -4,7 +4,7 @@ ============================================================ */ // ← EINZIGE Stelle für die Version — STATIC_ASSETS und CACHE_VERSION leiten sich ab -const VER = '1246'; +const VER = '1247'; const CACHE_VERSION = `by-v${VER}`; const CACHE_STATIC = `${CACHE_VERSION}-static`; const CACHE_TILES = 'ban-yaro-tiles-v1'; // bleibt über SW-Updates erhalten