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 markerLayer = null;
|
||||||
var legendControl = null;
|
var legendControl = null;
|
||||||
var lageData = {};
|
var lageData = {};
|
||||||
|
var dataLoaded = false;
|
||||||
|
|
||||||
/* ==================== 3D CAROUSEL ==================== */
|
/* ==================== 3D CAROUSEL ==================== */
|
||||||
var cards = document.querySelectorAll('.carousel-card');
|
var cards = document.querySelectorAll('.carousel-card');
|
||||||
@@ -94,7 +95,8 @@
|
|||||||
dots.forEach(function (dot, i) {
|
dots.forEach(function (dot, i) {
|
||||||
dot.classList.toggle('active', i === idx);
|
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 lage = cards[idx].getAttribute('data-lage');
|
||||||
var mapSection = document.getElementById('map-section');
|
var mapSection = document.getElementById('map-section');
|
||||||
if (lage && lageData[lage]) {
|
if (lage && lageData[lage]) {
|
||||||
@@ -209,7 +211,10 @@ function mdToHtml(md) {
|
|||||||
locations: data.locations || [],
|
locations: data.locations || [],
|
||||||
category_labels: data.category_labels || {}
|
category_labels: data.category_labels || {}
|
||||||
};
|
};
|
||||||
|
dataLoaded = true;
|
||||||
createMap();
|
createMap();
|
||||||
|
var mapSection = document.getElementById('map-section');
|
||||||
|
if (mapSection) mapSection.classList.remove('map-hidden');
|
||||||
showMarkers(data.locations || [], data.category_labels || {});
|
showMarkers(data.locations || [], data.category_labels || {});
|
||||||
})
|
})
|
||||||
.catch(function () {
|
.catch(function () {
|
||||||
@@ -310,7 +315,8 @@ function mdToHtml(md) {
|
|||||||
div.innerHTML = html;
|
div.innerHTML = html;
|
||||||
return div;
|
return div;
|
||||||
};
|
};
|
||||||
legend.addTo(mapInstance);
|
legendControl = legend;
|
||||||
|
legendControl.addTo(mapInstance);
|
||||||
|
|
||||||
if (bounds.length > 0) {
|
if (bounds.length > 0) {
|
||||||
mapInstance.fitBounds(bounds, { padding: [30, 30], maxZoom: 7 });
|
mapInstance.fitBounds(bounds, { padding: [30, 30], maxZoom: 7 });
|
||||||
|
|||||||
In neuem Issue referenzieren
Einen Benutzer sperren