diff --git a/static/js/app.js b/static/js/app.js index 1d89445..129130c 100644 --- a/static/js/app.js +++ b/static/js/app.js @@ -127,13 +127,31 @@ const Globe = { _onLageChange(lageId) { this._currentLageId = lageId ? parseInt(lageId) : null; - // Monitor-Layer aktualisieren wenn aktiv - if (typeof MonitorLayer !== 'undefined' && MonitorLayer._points) { + if (typeof MonitorLayer === 'undefined') return; + + if (lageId) { + // Monitor-Layer automatisch starten wenn nicht aktiv + if (!MonitorLayer._points) { + MonitorLayer.start(this.viewer); + var cb = document.getElementById('layer-monitor'); + if (cb) cb.checked = true; + } MonitorLayer._data = []; MonitorLayer._incidents = []; MonitorLayer._render(); - if (lageId) MonitorLayer._fetchForLage(lageId); + MonitorLayer._fetchForLage(lageId); + } else { + // Keine Lage: Monitor-Layer stoppen + MonitorLayer.stop(); + var cb = document.getElementById('layer-monitor'); + if (cb) cb.checked = false; } + + // Katastrophen-Layer Monitor-Kontext aktualisieren + if (typeof DisastersLayer !== 'undefined' && DisastersLayer._dataSource) { + DisastersLayer._fetchMonitorContext(); + } + // Sidebar aktualisieren if (typeof Sidebar !== 'undefined') Sidebar.update(); },