feat(node): add draggable, connectable and selectable options

This commit is contained in:
moklick
2020-07-22 11:27:11 +02:00
parent abb5770edd
commit 48bde20ded
4 changed files with 34 additions and 7 deletions
+7 -3
View File
@@ -34,6 +34,10 @@ function renderNode(
const isSelected = selectedElements ? selectedElements.some(({ id }) => id === node.id) : false;
const isDraggable = !!(node.draggable || (nodesDraggable && typeof node.draggable === 'undefined'));
const isSelectable = !!(node.selectable || (elementsSelectable && typeof node.selectable === 'undefined'));
const isConnectable = !!(node.connectable || (nodesConnectable && typeof node.connectable === 'undefined'));
return (
<NodeComponent
key={node.id}
@@ -53,9 +57,9 @@ function renderNode(
selected={isSelected}
style={node.style}
className={node.className}
isDraggable={nodesDraggable}
isSelectable={elementsSelectable}
isConnectable={nodesConnectable}
isDraggable={isDraggable}
isSelectable={isSelectable}
isConnectable={isConnectable}
sourcePosition={node.sourcePosition}
targetPosition={node.targetPosition}
selectNodesOnDrag={props.selectNodesOnDrag}