Update Node
Change a node from outside the canvas - its label, colour, position and interaction flags - by setting properties on the BlowNode and letting the page re-render, as React Flow's updateNode example does. Duplicate copies the node, with everything set on it, through BlowNode.Clone.
Press Tab to move between the nodes and edges of the diagram.
Press Enter or Space to select it, Shift with Enter to add it to the selection, the arrow keys to move the selected nodes, Delete to remove them and Escape to clear the selection. Press C to start a connection from it.
Press Enter or Space to select it, Delete to remove it and Escape to clear the selection. Press C to move its end to another node.
bit BlowTry it
- Type a label: node 1 is relabelled as you type, and grows or shrinks to fit.
- Pick a bg colour: node 1's background changes.
- Press Move randomly: node 1 jumps somewhere else and the view follows it.
- Press Duplicate: a copy of node 1 appears beside it, with its label, colour and flags as they are now. Copies are independent: the toolbar goes on changing node 1 only.
- Untick draggable: node 1 no longer moves, by pointer or arrow keys, and loses the grab cursor - but can still be selected and connected.
- Untick selectable: clicks, Shift+drag boxes and Ctrl+A pass node 1 by - but it can still be dragged.
- Untick connectable: no connection can start from or end on node 1's handles.
- Untick focusable, click the background and press Tab: focus moves through the edges and the other nodes but skips node 1.
How it works
BlowNodeis a mutable class: the toolbar setsLabel,StyleandPositionon the node in the list, and the canvas draws the change on the render that follows. A node without an explicit size is measured again when its content changes.FitViewAsync(300)eases the view to the graph after the move, so the node never leaves the screen.Clone(newId)copies every property of the node under a new id - label, style, size, flags;Datais shared by reference rather than copied. The page offsets the copy'sPositionand clearsSelectedbefore adding it to the list.Draggable,Selectable,ConnectableandFocusableare all on by default. Each turns one kind of interaction off for this node alone;NodesDraggable,NodesConnectable,ElementsSelectableandNodesFocusableon the canvas do the same for every node.- A node that is already selected stays selected when it stops being selectable, so the page clears
Selectedas it unticks the box.