Skip to content

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.

Group A
Resize me
Sink
Child 1
Child 2
Arrow keys move the view, Home shows the whole flow.
bit Blow

Try 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 ParentId is a child: its Position is 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.ExtentParent keeps a child inside its parent's box, and BlowNode.ExpandParent grows the parent instead; ExtentParent wins 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 (Visible is null by default). MinWidth/MinHeight default to 40 × 30 (100 × 50 here), and ShowEdgeControls (on by default) lets the four sides be dragged along their whole length. Resizing writes the node's Width and Height, and its Position when the left or top edge moves.
  • BlowNodeToolbar anchors its content to the node: Position picks the side (Top by default), Align where along it (Center) and Offset the 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 Data and a new Style, which the canvas redraws. Delete calls DeleteElementsAsync(nodes: [node]) on the canvas - the same path as the Delete key, so the node's edges go with it and Deletable, OnBeforeDelete and OnNodesDelete all apply.
  • IsValidConnection takes a BlowConnection and returns false to refuse it. It runs on every prospective connection while you drag, and Target is the target-side node whichever end the drag started from.
An unhandled error has occurred. Reload 🗙