Fix map zoom failing due to hidden owner layers on load
Deploy TrassenPlaner / deploy (push) Waiting to run Details

This commit is contained in:
Johannes Baumeister 2026-04-20 12:06:28 +02:00
parent c1004108d0
commit d226fe5bdd
1 changed files with 7 additions and 2 deletions

View File

@ -2890,8 +2890,13 @@
updateOwnerLayer();
// Zoom to owner data if available
if (layers.owners && layers.owners.getBounds().isValid()) {
map.fitBounds(layers.owners.getBounds(), { padding: [20, 20] });
if (state.owners && state.owners.features.length > 0) {
try {
const bounds = L.geoJSON(state.owners).getBounds();
if (bounds.isValid()) {
map.fitBounds(bounds, { padding: [20, 20] });
}
} catch(e) {}
}
}
} catch (e) { console.error("[V3-Sync] Owners Error:", e); }