Routen-GL-Fix: Detail/Suggest-Karte fittet Route korrekt (Modal-0×0-Timing)

- Facade fitBounds: try/catch + skip wenn Container 0×0 (sonst NaN-LngLat im Modal)
- createMap: mehrfaches resize() nach Erstellung (Modal-Animation)
- _buildDetailMap/_suggestMap: Re-Fit nach 200/500ms (Route ganz sichtbar, Pfeile)
- Facade: scrollWheelZoom-Stub (map.scrollZoom)
This commit is contained in:
rene 2026-06-05 13:01:19 +02:00
parent 96119e02ef
commit fbaf7c5409
7 changed files with 35 additions and 22 deletions

View file

@ -1 +1 @@
1196
1197

View file

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

View file

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

@ -25,10 +25,13 @@
panTo: function (latlon) { map.panTo(_ll(latlon)); return this; },
fitBounds: function (b, opts) {
var bb = _toBounds(b);
if (bb) {
var pad = 40;
// Nur fitten wenn Bounds gültig UND der Container eine Größe hat (im Modal
// ist er beim Erstellen 0×0 → fitBounds würde NaN werfen; der Re-Fit nach
// Modal-Animation greift dann).
if (bb && !isNaN(bb.getWest()) && map.getContainer().clientWidth > 0) {
var pad = 30;
if (opts && opts.padding) pad = Array.isArray(opts.padding) ? opts.padding[0] : opts.padding;
map.fitBounds(bb, { padding: pad, maxZoom: opts && opts.maxZoom, duration: 0 });
try { map.fitBounds(bb, { padding: pad, maxZoom: opts && opts.maxZoom, duration: 0 }); } catch (e) {}
}
return this;
},
@ -46,6 +49,8 @@
off: function (ev, fn) { map.off(ev, fn); return this; },
getZoom: function () { return map.getZoom(); },
getCenter: function () { var c = map.getCenter(); return { lat: c.lat, lng: c.lng }; },
// Leaflet-Handler-Stub (z.B. _suggestMap.scrollWheelZoom.disable()).
scrollWheelZoom: { disable: function () { try { map.scrollZoom.disable(); } catch (e) {} }, enable: function () { try { map.scrollZoom.enable(); } catch (e) {} } },
// Distanz in Metern (Haversine) — Ersatz für Leaflets map.distance.
distance: function (a, b) {
var la = a.lat != null ? a.lat : a[0], lo = a.lng != null ? a.lng : a[1];
@ -177,6 +182,10 @@
map.addControl(new maplibregl.AttributionControl({
compact: true, customAttribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
}));
// Container kann beim Erstellen (Modal/Animation) noch 0×0 sein → mehrfach resizen.
var _rz = function () { try { map.resize(); } catch (e) {} };
requestAnimationFrame(_rz);
setTimeout(_rz, 120); setTimeout(_rz, 400);
return _wrapMap(map);
},

View file

@ -617,8 +617,8 @@ window.Page_routes = (() => {
UI.map.circleMarker(lls[0], { radius:7, color:'#22C55E', fillColor:'#22C55E', fillOpacity:1, weight:2 }).addTo(_suggestMap);
UI.map.circleMarker(lls.at(-1), { radius:7, color:'#EF4444', fillColor:'#EF4444', fillOpacity:1, weight:2 }).addTo(_suggestMap);
_addRouteArrows(_suggestMap, track, '#3b82f6');
_suggestMap.fitBounds(poly.getBounds(), { padding: [16, 16] });
setTimeout(() => _suggestMap?.invalidateSize(), 120);
const _sfit = () => { _suggestMap?.invalidateSize(); _suggestMap?.fitBounds(poly.getBounds(), { padding: [16, 16] }); };
_sfit(); setTimeout(_sfit, 200); setTimeout(_sfit, 500);
};
_initMap();
@ -2653,7 +2653,11 @@ window.Page_routes = (() => {
_addRouteArrows(m, track, '#3b82f6');
UI.map.circleMarker(lls[0], { radius:7, color:'#22C55E', fillColor:'#22C55E', fillOpacity:1 }).addTo(m);
UI.map.circleMarker(lls.at(-1), { radius:7, color:'#EF4444', fillColor:'#EF4444', fillOpacity:1 }).addTo(m);
m.fitBounds(poly.getBounds(), { padding:[10,10] });
// Mehrfach fitten: beim Erstellen ist der Modal-Container evtl. noch 0×0 → nach
// der Animation (resize) erneut auf die ganze Route zoomen.
const _fit = () => { m.invalidateSize(); m.fitBounds(poly.getBounds(), { padding:[16,16] }); };
_fit();
setTimeout(_fit, 200); setTimeout(_fit, 500);
return m;
}

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=1196"></script>
<script src="/js/landing-init.js?v=1197"></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 = '1196';
const VER = '1197';
const CACHE_VERSION = `by-v${VER}`;
const CACHE_STATIC = `${CACHE_VERSION}-static`;
const CACHE_TILES = 'ban-yaro-tiles-v1'; // bleibt über SW-Updates erhalten