Handle Positions
The built-in nodes put their handles wherever SourcePosition and TargetPosition say, with no custom template. Switch the flow between left-to-right and top-to-bottom: the handles move to the matching sides and the edges leave and enter accordingly.
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
- Pick top to bottom: each target handle moves to the top of its node and each source handle to the bottom, the graph is laid out downwards, and the view refits.
- Pick left to right: the handles go back to the left and right sides.
- Drag from a handle to connect nodes in either direction: new edges leave and enter on the current sides too.
How it works
SourcePositionandTargetPosition(BottomandTopby default) pick the side of the built-in source and target handles. They are also where an edge is anchored when its node has no matching handle.- Smooth-step edges, like every edge type, leave a handle in the direction of its side, so the same four edges read across or down.
- A handle that moves to another side changes no node's size, which is all the canvas's resize observer watches.
UpdateNodeInternals()has every node read again; this page re-renders on the change anyway, which also re-reads them, but a change made from anywhere else - a component inside a node, a timer - would not. - The page moves the nodes too - top to bottom is the left-to-right layout turned on its side - and eases the view to them with
FitViewAsync(300).