fix: ensure ALKIS and building layers are sent to back when toggled on/off in the layer control
Deploy Standortplaner / deploy (push) Successful in 17s Details

This commit is contained in:
Johannes Baumeister 2026-06-25 09:55:08 +02:00
parent 6f3001dff8
commit a92b054645
1 changed files with 11 additions and 0 deletions

11
app.js
View File

@ -77,6 +77,17 @@ document.addEventListener('DOMContentLoaded', async () => {
maxZoom: 19
}).addTo(state.map);
// Automatisches Sortieren der Layer beim Ein-/Ausschalten
state.map.on('overlayadd', (e) => {
const name = (e.name || '').toLowerCase();
if (name.includes('eigentümer') || name.includes('flurstücke') || name.includes('alkis') || name.includes('gebäude')) {
if (typeof e.layer.bringToBack === 'function') {
e.layer.bringToBack();
console.log(`Layer ${e.name} in den Hintergrund verschoben.`);
}
}
});
// Layer Groups for Variants
const variantLayers = {
'A': L.layerGroup().addTo(state.map),