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:
parent
448066567d
commit
f4f597edf8
6 changed files with 52 additions and 18 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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 => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue