Karte: Follow-Button (Crosshair) wie in Routen — ein Tipp folgt dem Standort

Wunsch Rene: sichtbarer Follow-Schalter direkt auf der Karte statt nur ueber
das Speed-Dial. Crosshair links unter den Zoom-Reglern (unterhalb des
Offline-Puls-Icons): Tipp = zentrieren + folgen (Button farbig), Karte
ziehen = pausiert (grau). Synchron mit Standort-Speed-Dial-Button und
Aufzeichnungs-Start (beide aktivieren Follow ebenfalls).
Bump v1245
This commit is contained in:
rene 2026-06-06 19:58:56 +02:00
parent 448066567d
commit f4f597edf8
6 changed files with 52 additions and 18 deletions

View file

@ -1 +1 @@
1244
1245

View file

@ -86,14 +86,14 @@
<title>Ban Yaro</title>
<!-- Theme + theme-color Statusleiste vor CSS setzen -->
<script src="/js/boot-early.js?v=1244"></script>
<script src="/js/boot-early.js?v=1245"></script>
<!-- CSS: Reihenfolge ist wichtig — ?v= zwingt Browser zur Neuladung -->
<link rel="stylesheet" href="/css/design-system.css?v=1244">
<link rel="stylesheet" href="/css/layout.css?v=1244">
<link rel="stylesheet" href="/css/components.css?v=1244">
<link rel="stylesheet" href="/css/utilities.css?v=1244">
<link rel="stylesheet" href="/css/lists.css?v=1244">
<link rel="stylesheet" href="/css/design-system.css?v=1245">
<link rel="stylesheet" href="/css/layout.css?v=1245">
<link rel="stylesheet" href="/css/components.css?v=1245">
<link rel="stylesheet" href="/css/utilities.css?v=1245">
<link rel="stylesheet" href="/css/lists.css?v=1245">
</head>
<body>
@ -612,11 +612,11 @@
<div id="modal-container"></div>
<!-- JS: Reihenfolge ist wichtig — erst Basis, dann Features -->
<script src="/js/api.js?v=1244"></script>
<script src="/js/ui.js?v=1244"></script>
<script src="/js/app.js?v=1244"></script>
<script src="/js/worlds.js?v=1244"></script>
<script src="/js/offline-indicator.js?v=1244"></script>
<script src="/js/api.js?v=1245"></script>
<script src="/js/ui.js?v=1245"></script>
<script src="/js/app.js?v=1245"></script>
<script src="/js/worlds.js?v=1245"></script>
<script src="/js/offline-indicator.js?v=1245"></script>
<!-- Feature-Seiten werden lazy geladen -->
@ -626,7 +626,7 @@
<!-- Boot: Offline-Banner + SW-Registration (extrahiert für CSP) -->
<script src="/js/boot.js?v=1244"></script>
<script src="/js/boot.js?v=1245"></script>
</body>

View file

@ -3,7 +3,7 @@
Router, State-Management, Navigation, Initialisierung.
============================================================ */
const APP_VER = '1244'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen
const APP_VER = '1245'; // ← 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;

View file

@ -167,6 +167,7 @@ window.Page_map = (() => {
await _loadLeaflet();
_initMap(); // Leaflet-Raster (Default), sofort mit Deutschland-Mitte starten
}
_ensureFollowBtn(); // Crosshair-Button (Karte folgt Standort, wie in Routen)
_startLocationTracking();
_loadAll();
_offerResume(); // unterbrochene Aufzeichnung anbieten
@ -368,6 +369,7 @@ window.Page_map = (() => {
// Follow-Mode (René 2026-06-08): Karte wandert ab jetzt mit dem Standort;
// manuelles Verschieben beendet das Folgen (dragstart-Listener im Map-Init).
_followGps = true;
_updateFollowBtn();
UI.toast.info('Karte folgt deinem Standort — zum Beenden Karte verschieben.');
} else {
UI.toast.error('Standort noch nicht verfügbar.');
@ -789,7 +791,7 @@ window.Page_map = (() => {
window.addEventListener('resize', () => _map.invalidateSize());
_map.on('moveend zoomend', () => { _autoRetryCount = 0; _updateZoomDisplay(); _scheduleOsmLoad(); });
_map.on('dragstart', () => { _followGps = false; }); // manuelles Verschieben beendet Follow
_map.on('dragstart', () => { _followGps = false; _updateFollowBtn(); }); // manuelles Verschieben beendet Follow
setTimeout(() => { _updateZoomDisplay(); _scheduleOsmLoad(); }, 800);
// Fadenkreuz-Animation beim Kartenverschieben
@ -825,6 +827,37 @@ window.Page_map = (() => {
try { return !!(window.BY && BY.offlineTiles()); } catch (e) { return false; }
}
// ----------------------------------------------------------
// Follow-Button auf der Karte (Wunsch René 2026-06-06: „wie in Routen") —
// Crosshair links unter den Zoom-Reglern (unterhalb des Offline-Puls-Icons).
// Ein Tipp = zentrieren + folgen; Karte ziehen = Folgen pausiert (Button grau).
// ----------------------------------------------------------
function _updateFollowBtn() {
const b = document.getElementById('map-follow-btn');
if (b) b.style.color = _followGps ? 'var(--c-primary)' : 'var(--c-text-secondary, #9ca3af)';
}
function _ensureFollowBtn() {
const host = document.getElementById('central-map');
if (!host || document.getElementById('map-follow-btn')) { _updateFollowBtn(); return; }
const b = document.createElement('button');
b.id = 'map-follow-btn';
b.type = 'button';
b.title = 'Karte folgt deinem Standort';
b.style.cssText = 'position:absolute;left:10px;top:calc(env(safe-area-inset-top, 0px) + 150px);'
+ 'z-index:500;width:38px;height:38px;border-radius:50%;border:none;'
+ 'background:var(--c-surface,#fff);box-shadow:0 2px 8px rgba(0,0,0,.3);'
+ 'display:flex;align-items:center;justify-content:center;cursor:pointer';
b.innerHTML = `<svg class="ph-icon" aria-hidden="true" style="width:20px;height:20px"><use href="/icons/phosphor.svg#crosshair"></use></svg>`;
b.addEventListener('click', () => {
if (!_userPos) { UI.toast.error('Standort noch nicht verfügbar.'); return; }
_followGps = true;
_mapSetView(_userPos.lat, _userPos.lon, Math.max(14, Math.round(_mapGetZoom())));
_updateFollowBtn();
});
host.appendChild(b);
_updateFollowBtn();
}
function loadMapLibre() {
if (_maplibreLoaded) return Promise.resolve();
const v = '?v=' + (window.APP_VER || '');
@ -967,7 +1000,7 @@ window.Page_map = (() => {
_map.on('movestart', () => {
document.getElementById('map-crosshair')?.classList.add('dragging');
});
_map.on('dragstart', () => { _followGps = false; }); // manuelles Verschieben beendet Follow
_map.on('dragstart', () => { _followGps = false; _updateFollowBtn(); }); // manuelles Verschieben beendet Follow
window.addEventListener('resize', _mapResize);
setTimeout(_mapResize, 100);
@ -2618,6 +2651,7 @@ window.Page_map = (() => {
_recTimerInt = setInterval(_updateRecStatus, 1000);
_followGps = true; // Aufzeichnung startet im Follow-Mode (Drag pausiert, Standort-Button reaktiviert)
_updateFollowBtn();
_recWatchId = navigator.geolocation.watchPosition(
pos => {

View file

@ -4,7 +4,7 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="color-scheme" content="light dark">
<script src="/js/landing-init.js?v=1244"></script>
<script src="/js/landing-init.js?v=1245"></script>
<title>Ban Yaro — Die Hunde-App für Deutschland, Österreich & Schweiz</title>
<meta name="description" content="Ban Yaro: Die kostenlose All-in-One Hunde-App für DACH. Tagebuch, Giftköder-Alarm, Training mit KI, Forum, Wurfbörse, Stammbaum, Inzucht-Check — DSGVO-konform, offline-fähig, ohne App Store.">
<meta name="keywords" content="Hunde App, Hunde Community, Wurfbörse, Züchter, Welpen kaufen, Stammbaum Hund, Inzuchtkoeffizient, Hundezucht, Impfpass Hund, Giftköder Alarm, Gassi Community, Hundetraining App, Hunde Forum, Hunde KI, Hundefilm Datenbank, Welpen Marktplatz">

View file

@ -4,7 +4,7 @@
============================================================ */
// ← EINZIGE Stelle für die Version — STATIC_ASSETS und CACHE_VERSION leiten sich ab
const VER = '1244';
const VER = '1245';
const CACHE_VERSION = `by-v${VER}`;
const CACHE_STATIC = `${CACHE_VERSION}-static`;
const CACHE_TILES = 'ban-yaro-tiles-v1'; // bleibt über SW-Updates erhalten