Groups, Resizing, Toolbars & Validation
A group node that carries its children (ParentId), a node with a
BlowNodeResizer and a BlowNodeToolbar, and an IsValidConnection rule
that decides what may connect - the building blocks of a sub-flow editor.
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
- Drag the dashed Group A by an empty part of it: Child 1 and Child 2 move with it.
- Choose how the children behave in Children, then drag a child against the group's edge: with Move freely it leaves the box but still moves with the group, with Stay inside the group it stops at the border, and with Grow the group the group grows to keep it inside.
- Click the blue Resize me node: resize controls appear round it. Drag a corner square, or anywhere along a side, to resize it - no smaller than 100 × 50. Press Escape during the drag to put it back as it was.
- While Resize me is selected, its toolbar floats above it: Recolor gives it a new tint on every click, and Delete removes it with its edges. Zoom in and out - the toolbar keeps its size on screen.
- Drag from a child's bottom handle: as the drag starts, every handle that would accept the connection turns green and every other one red and faded. Only connections that end at Sink are allowed, so a drop on Resize me does nothing while a drop on Sink connects.
- Press Reset to bring back the starting graph.
How it works
- A node with a
ParentIdis a child: itsPositionis relative to its parent's top-left corner, it moves with the parent, and it is drawn above it.Type = "group"is the built-in look for a parent - translucent, dashed, with its label in the corner and no handles. BlowNode.ExtentParentkeeps a child inside its parent's box, andBlowNode.ExpandParentgrows the parent instead;ExtentParentwins when both are set. Both are off by default, and the Children select sets them on the two children.BlowNodeResizer, placed in the node's template, shows its controls while the node is selected (Visibleis null by default).MinWidth/MinHeightdefault to 40 × 30 (100 × 50 here), andShowEdgeControls(on by default) lets the four sides be dragged along their whole length. Resizing writes the node'sWidthandHeight, and itsPositionwhen the left or top edge moves.BlowNodeToolbaranchors its content to the node:Positionpicks the side (Topby default),Alignwhere along it (Center) andOffsetthe gap in screen pixels (8). Like the resizer it shows only while the node is selected, and a press inside it neither drags the node nor pans.- Recolor gives the node new
Dataand a newStyle, which the canvas redraws. Delete callsDeleteElementsAsync(nodes: [node])on the canvas - the same path as the Delete key, so the node's edges go with it andDeletable,OnBeforeDeleteandOnNodesDeleteall apply. IsValidConnectiontakes aBlowConnectionand returns false to refuse it. It runs on every prospective connection while you drag, andTargetis the target-side node whichever end the drag started from.