Skip to content

Default Edge Overwrite

DefaultEdgeOptions gives every edge the user draws a house style - here an animated, round-cornered smooth step with a closed arrow, a thicker indigo stroke, a wider hit area and ends that stay put. The edge already in the list keeps the plain defaults: the options only reach new edges.

Drag from my handle
to here
or here
bit Blow

Try it

  • Drag from the dot under Drag from my handle to the dot on top of or here: the new edge arrives animated, smooth-stepped with round corners, indigo, thicker and with a filled arrowhead.
  • Compare it with the grey edge into to here, which was in the list from the start and keeps the built-in look.
  • Click near the new edge rather than on it: its wider hit area still selects it.
  • With the new edge selected no end dots appear, so its ends cannot be dragged to other handles; select the grey edge and its two dots are there to drag.
  • Press Backspace or Delete to remove a selected edge and draw it again.

How it works

  • DefaultEdgeOptions takes a BlowDefaultEdgeOptions, applied to each edge the moment the user creates it; edges put in the Edges list by code are left alone.
  • Type = SmoothStep sets the path; left null it falls back to the canvas's DefaultEdgeType. PathOptions (here a BorderRadius of 16 instead of 5) is cloned into each new edge, so retuning one edge never retunes the others.
  • Animated (off by default) runs the marching dash; MarkerType = ArrowClosed fills the arrowhead that MarkerEnd (on by default) draws.
  • Stroke and StrokeWidth replace the theme colour and the 1.5 width; InteractionWidth widens the invisible hit path from 14 to 24 screen pixels.
  • Reconnectable = false (true by default) keeps new edges' ends where they were drawn. Style, Class and MarkerStart are there too.
An unhandled error has occurred. Reload 🗙