Fix: Karte — position:absolute;inset:0 statt height:100% (kein parent-height Problem)

This commit is contained in:
rene 2026-04-14 16:51:47 +02:00
parent d4c3f159d5
commit 2ff439a4e3
3 changed files with 17 additions and 18 deletions

View file

@ -1565,9 +1565,9 @@ textarea.form-control {
ZENTRALE KARTE (map.js)
============================================================ */
.map-full-layout {
position: relative;
height: 100%;
overflow: hidden;
position: absolute;
inset: 0;
overflow: hidden;
}
.map-full {
width: 100%;

View file

@ -49,6 +49,16 @@ window.Page_map = (() => {
async function init(container, appState) {
_container = container;
_appState = appState;
// Map-Container braucht position:relative + kein Padding,
// damit .map-full-layout mit position:absolute;inset:0 korrekt füllt.
Object.assign(_container.style, {
padding: '0',
overflow: 'hidden',
position: 'relative',
gap: '0',
});
_render();
try { _userPos = await API.getLocation(); } catch {}
await _loadLeaflet();
@ -129,19 +139,6 @@ window.Page_map = (() => {
const el = document.getElementById('central-map');
if (!el || !window.L || _map) return;
// Explizite Pixel-Höhe setzen, damit Leaflet Kacheln lädt.
// height:100% auf einem flex:1-Child ohne feste Parent-Höhe = 0px.
const layout = el.closest('.map-full-layout');
if (layout) {
const top = layout.getBoundingClientRect().top;
layout.style.height = (window.innerHeight - top) + 'px';
window.addEventListener('resize', () => {
const t = layout.getBoundingClientRect().top;
layout.style.height = (window.innerHeight - t) + 'px';
_map?.invalidateSize();
});
}
const center = _userPos ? [_userPos.lat, _userPos.lon] : [51.1657, 10.4515];
const zoom = _userPos ? 13 : 6;
@ -151,7 +148,9 @@ window.Page_map = (() => {
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { maxZoom: 19 })
.addTo(_map);
setTimeout(() => _map.invalidateSize(), 100);
// invalidateSize nach kurzer Verzögerung, damit der Browser das Layout abgeschlossen hat
setTimeout(() => _map.invalidateSize(), 150);
window.addEventListener('resize', () => _map.invalidateSize());
}
// ----------------------------------------------------------

View file

@ -3,7 +3,7 @@
Offline-Cache + Push Notifications
============================================================ */
const CACHE_VERSION = 'by-v25';
const CACHE_VERSION = 'by-v26';
const CACHE_STATIC = `${CACHE_VERSION}-static`;
// Diese Dateien werden beim Install gecacht (App Shell)