fix(selection): dont render selection when another node gets selected

This commit is contained in:
moklick
2020-09-11 11:04:38 +02:00
parent 1425b8ffde
commit 4cc6b0af02
3 changed files with 10 additions and 6 deletions
+5 -4
View File
@@ -25,6 +25,7 @@ export default ({
}: NodesSelectionProps) => {
const [tX, tY, tScale] = useStoreState((state) => state.transform);
const selectedNodesBbox = useStoreState((state) => state.selectedNodesBbox);
const selectionActive = useStoreState((state) => state.selectionActive);
const selectedElements = useStoreState((state) => state.selectedElements);
const snapToGrid = useStoreState((state) => state.snapToGrid);
const snapGrid = useStoreState((state) => state.snapGrid);
@@ -34,10 +35,6 @@ export default ({
const grid = (snapToGrid ? snapGrid : [1, 1])! as [number, number];
if (!selectedElements) {
return null;
}
const selectedNodes = useMemo(
() =>
selectedElements
@@ -109,6 +106,10 @@ export default ({
[selectedNodesBbox]
);
if (!selectedElements || selectionActive) {
return null;
}
return (
<div className="react-flow__nodesselection" style={style}>
<ReactDraggable