Clear selection when changing maps

This commit is contained in:
Mitchell McCaffrey 2021-07-23 15:43:32 +10:00
parent 5546bf525e
commit b3fc7f9e1d

View File

@ -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);
}