UPDATE
This commit is contained in:
@@ -108,6 +108,11 @@ export default function CropZoningMap({
|
||||
geoJsonLayer.addTo(map)
|
||||
zonesLayerRef.current = geoJsonLayer
|
||||
|
||||
const bounds = geoJsonLayer.getBounds()
|
||||
if (bounds.isValid()) {
|
||||
map.fitBounds(bounds, { padding: [24, 24] })
|
||||
}
|
||||
|
||||
let idx = 0
|
||||
geoJsonLayer.eachLayer((layer: L.Layer) => {
|
||||
const leafLayer = layer as L.Polygon
|
||||
@@ -183,6 +188,10 @@ export default function CropZoningMap({
|
||||
drawnItems.clearLayers()
|
||||
L.geoJSON(initialAreaGeoJson as unknown as Feature<Polygon>).eachLayer((layer) => drawnItems.addLayer(layer))
|
||||
emitAreaChange()
|
||||
const bounds = drawnItems.getBounds()
|
||||
if (bounds.isValid()) {
|
||||
map.fitBounds(bounds, { padding: [24, 24] })
|
||||
}
|
||||
}
|
||||
|
||||
const onCreated = (e: L.LeafletEvent) => {
|
||||
|
||||
Reference in New Issue
Block a user