fix(selection): only calculate selection box if selected nodes > 0

This commit is contained in:
moklick
2022-06-16 13:33:36 +02:00
parent 6fbea44465
commit e03d6c23ec
2 changed files with 12 additions and 1 deletions
+8 -1
View File
@@ -59,6 +59,10 @@ const LayoutFlow = () => {
setNodes(layoutedNodes);
};
const unselect = () => {
setNodes((nds) => nds.map((n) => ({ ...n, selected: false })));
};
return (
<div className="layoutflow">
<ReactFlowProvider>
@@ -77,7 +81,10 @@ const LayoutFlow = () => {
<button onClick={() => onLayout('TB')} style={{ marginRight: 10 }}>
vertical layout
</button>
<button onClick={() => onLayout('LR')}>horizontal layout</button>
<button onClick={() => onLayout('LR')} style={{ marginRight: 10 }}>
horizontal layout
</button>
<button onClick={() => unselect()}>unselect nodes</button>
</div>
</ReactFlowProvider>
</div>