Skip to content

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.

2 source handle(s)
Source
A
B
bit Blow

Try 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 NodeTemplate draws _handleCount BlowHandles with ids h0, h1, ... and spreads them with Style="top:N%". An edge picks its handle by SourceHandle.
  • 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 SourcePosition side (Bottom by default) - so removing the handle's edges, as this page does unless you untick the box, is the application's decision.
An unhandled error has occurred. Reload 🗙