fix: ensure ALKIS and building layers are sent to back when toggled on/off in the layer control
This commit is contained in:
parent
6f3001dff8
commit
a92b054645
11
app.js
11
app.js
|
|
@ -77,6 +77,17 @@ document.addEventListener('DOMContentLoaded', async () => {
|
||||||
maxZoom: 19
|
maxZoom: 19
|
||||||
}).addTo(state.map);
|
}).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
|
// Layer Groups for Variants
|
||||||
const variantLayers = {
|
const variantLayers = {
|
||||||
'A': L.layerGroup().addTo(state.map),
|
'A': L.layerGroup().addTo(state.map),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue