Skip to content

Self-Connections

An edge back to the node it left has no route between two nodes to compute, so every ordinary path algorithm would collapse onto the node itself. Blow loops it clear instead - whatever its Type, and wherever its two handles sit - and AllowSelfConnections lets the user draw one.

retrypoll againrecurse
Retry
Poll
Recurse
bit Blow

Try it

  • Look at the three loops: Retry goes from its right handle round the bottom to its left one, Poll from its right handle round the corner to its top one, and Recurse from its bottom handle round the side to its top one.
  • Move Loop radius: every loop swings further out from its node or tucks in closer.
  • Change Path type: the edge from Poll down to Recurse changes shape, while the loops stay loops whatever the type.
  • Untick Animated loops to stop the dash marching round them.
  • Drag from a node's right or bottom handle back to its own top or left handle: a new loop appears, with the current radius, type and animation.
  • Drag a node: its loop travels with it.

How it works

  • An edge whose Source and Target are the same node is drawn as a loop that swings clear of the node, its Type ignored: a bezier or a step between two handles of one node would run through the node.
  • SourceHandle and TargetHandle pick the two handles by id, so the same node can loop across itself, round a corner or round a side.
  • BlowEdgePathOptions.LoopRadius (60 by default) is how far the loop stands off its node; the slider sets it on every loop through each edge's PathOptions.
  • Such an edge can always be put in the Edges list. AllowSelfConnections (off by default) lets the user draw one, and only between two different handles; ConnectionRadius, raised from 20 to 30 here, is how near a handle a release still snaps to it.
  • OnConnect fires once the new edge is in the list, so the page restyles it there with the others.
An unhandled error has occurred. Reload 🗙