diff --git a/CMBNet/static/js/sw.js b/CMBNet/static/js/sw.js index 281de43..7734d97 100644 --- a/CMBNet/static/js/sw.js +++ b/CMBNet/static/js/sw.js @@ -5,7 +5,7 @@ * damit er sowohl die mobilen Views als auch die statischen Assets * kontrolliert. Der Cache-Name wird pro App-Wurzel gebildet. */ -const VERSION = 'cmbnet-pwa-v12'; +const VERSION = 'cmbnet-pwa-v13'; const BASE = new URL('./', self.location).href; const SHELL_CACHE = `${VERSION}-shell`; const TILE_CACHE = `${VERSION}-tiles`; diff --git a/CMBNet/static/js/views/mobile.js b/CMBNet/static/js/views/mobile.js index 423f72b..2a9b37f 100644 --- a/CMBNet/static/js/views/mobile.js +++ b/CMBNet/static/js/views/mobile.js @@ -472,11 +472,29 @@ function bindTabs() { if (btn.dataset.tab === 'chat') { const cont = document.getElementById('mobileChatMessages'); if (cont) cont.scrollTop = cont.scrollHeight; + } else if (btn.dataset.tab === 'map') { + refreshMobileMap(); } }); }); } +function refreshMobileMap() { + if (!map) return; + + // Während der Chat-Ansicht ist der Kartencontainer display:none. Beim + // Zurückwechseln muss Leaflet die Größe neu messen. Zusätzlich werden die + // Kacheln neu angefordert, da sie im versteckten Zustand nicht aktualisiert + // wurden. + requestAnimationFrame(() => { + if (!map) return; + map.invalidateSize({pan: false}); + if (currentBaseLayer && typeof currentBaseLayer.redraw === 'function') { + currentBaseLayer.redraw(); + } + }); +} + function bindButtons() { const logout = document.getElementById('mobileLogout'); if (logout) logout.addEventListener('click', () => {window.location.href = window.CMBNET_LOGOUT_URL || appUrl('');});