fix: keep map canvas synchronized with workspace
GeoIntel CI / docs-smoke (push) Canceled after 0s
GeoIntel CI / contract-smoke (push) Canceled after 0s

This commit is contained in:
Codex
2026-07-14 15:51:10 +02:00
parent 986640d5b3
commit 3503641ea8
2 changed files with 9 additions and 0 deletions
@@ -40,6 +40,9 @@ def test_map_rectangle_drag_is_wired_to_automatic_analysis() -> None:
assert "map.on('mousemove'" in geomap
assert "map.on('mouseup'" in geomap
assert "onMapBboxSelectRef.current?.(bbox)" in geomap
assert "new ResizeObserver" in geomap
assert "resizeObserver.observe(containerRef.current)" in geomap
assert "resizeObserver.disconnect()" in geomap
def test_dataset_detail_responses_cannot_overwrite_the_latest_map_layer() -> None:
+6
View File
@@ -175,6 +175,10 @@ function GeoMap({
zoom: 11,
attributionControl: false,
})
const resizeObserver = new ResizeObserver(() => {
map.resize()
})
resizeObserver.observe(containerRef.current)
map.addControl(new maplibregl.NavigationControl(), 'top-right')
map.addControl(
new maplibregl.AttributionControl({
@@ -196,6 +200,7 @@ function GeoMap({
})
}
map.on('load', () => {
map.resize()
setMapStyleReady(true)
emitViewport()
})
@@ -274,6 +279,7 @@ function GeoMap({
mapRef.current = map
return () => {
resizeObserver.disconnect()
map.remove()
mapRef.current = null
setMapStyleReady(false)