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() {
|
_fetchMonitorContext() {
|
||||||
var self = this;
|
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(r) { return r.json(); })
|
||||||
.then(function(data) { self._monitorData = data; })
|
.then(function(data) { self._monitorData = data; })
|
||||||
.catch(function() {});
|
.catch(function() {});
|
||||||
@@ -36,21 +37,15 @@ const DisastersLayer = {
|
|||||||
|
|
||||||
_findMonitorSummary(lat, lon) {
|
_findMonitorSummary(lat, lon) {
|
||||||
if (!this._monitorData || !this._monitorData.incidents) return null;
|
if (!this._monitorData || !this._monitorData.incidents) return null;
|
||||||
// Finde naechsten Monitor-Punkt und dessen Lage-Summary
|
// Nur die aktuell ausgewaehlte Lage verwenden
|
||||||
var features = this._monitorData.features || [];
|
var selectedId = (typeof Globe !== 'undefined') ? Globe._currentLageId : null;
|
||||||
var best = null, bestDist = 999;
|
if (!selectedId) return null;
|
||||||
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;
|
|
||||||
var incidents = this._monitorData.incidents || [];
|
var incidents = this._monitorData.incidents || [];
|
||||||
|
var incident = null;
|
||||||
for (var j = 0; j < incidents.length; j++) {
|
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) {
|
_buildMonitorHtml(incident) {
|
||||||
|
|||||||
In neuem Issue referenzieren
Einen Benutzer sperren