Deselect when changing tools
This commit is contained in:
parent
543fe6f941
commit
ac4ca5b364
@ -1,4 +1,4 @@
|
|||||||
import { useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import SelectionMenu from "../components/selection/SelectionMenu";
|
import SelectionMenu from "../components/selection/SelectionMenu";
|
||||||
import SelectTool from "../components/tools/SelectTool";
|
import SelectTool from "../components/tools/SelectTool";
|
||||||
import { SelectionItemsChangeEventHandler } from "../types/Events";
|
import { SelectionItemsChangeEventHandler } from "../types/Events";
|
||||||
@ -22,9 +22,18 @@ function useMapSelection(
|
|||||||
setIsSelectionMenuOpen(open);
|
setIsSelectionMenuOpen(open);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const active = selectedToolId === "select";
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!active) {
|
||||||
|
setSelection(null);
|
||||||
|
setIsSelectionMenuOpen(false);
|
||||||
|
}
|
||||||
|
}, [active]);
|
||||||
|
|
||||||
const selectionTool = (
|
const selectionTool = (
|
||||||
<SelectTool
|
<SelectTool
|
||||||
active={selectedToolId === "select"}
|
active={active}
|
||||||
toolSettings={settings}
|
toolSettings={settings}
|
||||||
onSelectionItemsChange={onSelectionItemsChange}
|
onSelectionItemsChange={onSelectionItemsChange}
|
||||||
selection={selection}
|
selection={selection}
|
||||||
|
Loading…
Reference in New Issue
Block a user