Fix: Katastrophen-Summary nur aus ausgewaehlter Lage
_findMonitorSummary prueft jetzt Globe._currentLageId. Ohne Lage-Auswahl: keine Monitor-Summary im Popup. _fetchMonitorContext nutzt die gewaehlte Lage-ID statt alle.
Dieser Commit ist enthalten in:
@@ -28,7 +28,8 @@ const DisastersLayer = {
|
||||
|
||||
_fetchMonitorContext() {
|
||||
var self = this;
|
||||
fetch('/api/monitor-feed')
|
||||
var lageId = (typeof Globe !== 'undefined' && Globe._currentLageId) ? Globe._currentLageId : '';
|
||||
fetch('/api/monitor-feed' + (lageId ? '?incident_id=' + lageId : ''))
|
||||
.then(function(r) { return r.json(); })
|
||||
.then(function(data) { self._monitorData = data; })
|
||||
.catch(function() {});
|
||||
@@ -36,21 +37,15 @@ const DisastersLayer = {
|
||||
|
||||
_findMonitorSummary(lat, lon) {
|
||||
if (!this._monitorData || !this._monitorData.incidents) return null;
|
||||
// Finde naechsten Monitor-Punkt und dessen Lage-Summary
|
||||
var features = this._monitorData.features || [];
|
||||
var best = null, bestDist = 999;
|
||||
for (var i = 0; i < features.length; i++) {
|
||||
var c = features[i].geometry.coordinates;
|
||||
var d = Math.abs(c[1] - lat) + Math.abs(c[0] - lon);
|
||||
if (d < bestDist) { bestDist = d; best = features[i]; }
|
||||
}
|
||||
if (!best || bestDist > 5) return null;
|
||||
var incId = best.properties.incident_id;
|
||||
// Nur die aktuell ausgewaehlte Lage verwenden
|
||||
var selectedId = (typeof Globe !== 'undefined') ? Globe._currentLageId : null;
|
||||
if (!selectedId) return null;
|
||||
var incidents = this._monitorData.incidents || [];
|
||||
var incident = null;
|
||||
for (var j = 0; j < incidents.length; j++) {
|
||||
if (incidents[j].id === incId && incidents[j].summary) return incidents[j];
|
||||
if (incidents[j].id === selectedId && incidents[j].summary) { incident = incidents[j]; break; }
|
||||
}
|
||||
return null;
|
||||
return incident;
|
||||
},
|
||||
|
||||
_buildMonitorHtml(incident) {
|
||||
|
||||
In neuem Issue referenzieren
Einen Benutzer sperren