fix: Karte zeigt Iran sofort, Legende nicht mehr doppelt
- dataLoaded Flag verhindert Map-Update bevor Daten geladen sind - legendControl wird korrekt gespeichert und beim Wechsel entfernt Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Dieser Commit ist enthalten in:
@@ -76,6 +76,7 @@
|
||||
var markerLayer = null;
|
||||
var legendControl = null;
|
||||
var lageData = {};
|
||||
var dataLoaded = false;
|
||||
|
||||
/* ==================== 3D CAROUSEL ==================== */
|
||||
var cards = document.querySelectorAll('.carousel-card');
|
||||
@@ -94,7 +95,8 @@
|
||||
dots.forEach(function (dot, i) {
|
||||
dot.classList.toggle('active', i === idx);
|
||||
});
|
||||
// Update map based on active Lage
|
||||
// Update map based on active Lage (only after data loaded)
|
||||
if (!dataLoaded) return;
|
||||
var lage = cards[idx].getAttribute('data-lage');
|
||||
var mapSection = document.getElementById('map-section');
|
||||
if (lage && lageData[lage]) {
|
||||
@@ -209,7 +211,10 @@ function mdToHtml(md) {
|
||||
locations: data.locations || [],
|
||||
category_labels: data.category_labels || {}
|
||||
};
|
||||
dataLoaded = true;
|
||||
createMap();
|
||||
var mapSection = document.getElementById('map-section');
|
||||
if (mapSection) mapSection.classList.remove('map-hidden');
|
||||
showMarkers(data.locations || [], data.category_labels || {});
|
||||
})
|
||||
.catch(function () {
|
||||
@@ -310,7 +315,8 @@ function mdToHtml(md) {
|
||||
div.innerHTML = html;
|
||||
return div;
|
||||
};
|
||||
legend.addTo(mapInstance);
|
||||
legendControl = legend;
|
||||
legendControl.addTo(mapInstance);
|
||||
|
||||
if (bounds.length > 0) {
|
||||
mapInstance.fitBounds(bounds, { padding: [30, 30], maxZoom: 7 });
|
||||
|
||||
In neuem Issue referenzieren
Einen Benutzer sperren