Stabilize programmatic map fitting
This commit is contained in:
@@ -47,7 +47,7 @@ def test_map_rectangle_drag_is_wired_to_automatic_analysis() -> None:
|
|||||||
assert "new ResizeObserver" in geomap
|
assert "new ResizeObserver" in geomap
|
||||||
assert "resizeObserver.observe(containerRef.current)" in geomap
|
assert "resizeObserver.observe(containerRef.current)" in geomap
|
||||||
assert "fitDataOnChangeRef.current" in geomap
|
assert "fitDataOnChangeRef.current" in geomap
|
||||||
assert "map.fitBounds(bounds, { padding: 40, duration: 0 })" in geomap
|
assert geomap.count("map.fitBounds(bounds, { padding: 40, duration: 0 })") == 3
|
||||||
assert "const activeCollection = areaData ?? (fitDataOnChange ? data : null)" in geomap
|
assert "const activeCollection = areaData ?? (fitDataOnChange ? data : null)" in geomap
|
||||||
assert "data && fitDataOnChange && !areaData" in geomap
|
assert "data && fitDataOnChange && !areaData" in geomap
|
||||||
assert "resizeObserver.disconnect()" in geomap
|
assert "resizeObserver.disconnect()" in geomap
|
||||||
|
|||||||
@@ -426,7 +426,7 @@ function GeoMap({
|
|||||||
if (collection.type === 'FeatureCollection' && collection.features.length > 0) {
|
if (collection.type === 'FeatureCollection' && collection.features.length > 0) {
|
||||||
const bounds = collectCoordinates(collection)
|
const bounds = collectCoordinates(collection)
|
||||||
if (bounds) {
|
if (bounds) {
|
||||||
map.fitBounds(bounds, { padding: 40 })
|
map.fitBounds(bounds, { padding: 40, duration: 0 })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -497,7 +497,7 @@ function GeoMap({
|
|||||||
if (activeCollection) {
|
if (activeCollection) {
|
||||||
const bounds = collectCoordinates(activeCollection)
|
const bounds = collectCoordinates(activeCollection)
|
||||||
if (bounds) {
|
if (bounds) {
|
||||||
map.fitBounds(bounds, { padding: 40 })
|
map.fitBounds(bounds, { padding: 40, duration: 0 })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [areaData, data, fitDataOnChange, mapStyleReady])
|
}, [areaData, data, fitDataOnChange, mapStyleReady])
|
||||||
|
|||||||
Reference in New Issue
Block a user