diff --git a/src/hooks/useMapSelection.tsx b/src/hooks/useMapSelection.tsx index 6e7de10..ae9c9fe 100644 --- a/src/hooks/useMapSelection.tsx +++ b/src/hooks/useMapSelection.tsx @@ -32,6 +32,7 @@ function useMapSelection( const active = selectedToolId === "select"; + // Remove selection when changing tools useEffect(() => { if (!active) { setSelection(null); @@ -39,6 +40,12 @@ function useMapSelection( } }, [active]); + // Remove selection when changing maps + useEffect(() => { + setSelection(null); + setIsSelectionMenuOpen(false); + }, [map]); + function handleSelectionDragStart() { setIsSelectionDragging(true); }