Moving Handles
A node's handles can change while the app runs: here the Source node gains and loses outputs, the ones that stay spread out again along its side, and every edge follows its handle to the new place. Edges name their handles by id, so what happens to an edge whose handle is gone is up to you.
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
- Press Add handle: a new output appears on the right of Source, the others move up to make room, and both edges slide along with their handles.
- Drag from a new handle to A or B to connect it.
- Press Remove handle: the last output goes, and with it the edges that started there. It is disabled when one handle is left.
- Untick Remove a removed handle's edges and remove a handle with an edge on it: the edge stays, drawn from the middle of Source's bottom side. Add handle brings the handle back, and the edge returns to it.
How it works
- The handles are ordinary markup: the
NodeTemplatedraws_handleCountBlowHandles with idsh0,h1, ... and spreads them withStyle="top:N%". An edge picks its handle bySourceHandle. - Where a handle sits is measured by the browser. Adding or removing one is noticed on its own, and the node is read again - including the handles that moved to make room.
UpdateNodeInternals("src")asks for that read explicitly, for the named node only. It is the call to make whenever a node's handles change in a way nothing resizes - moved by a style, switched to another side - which the browser cannot report;Refresh(remeasure: true)reads every node.- An edge whose handle no longer exists is still drawn, from the middle of the node's
SourcePositionside (Bottomby default) - so removing the handle's edges, as this page does unless you untick the box, is the application's decision.