Skip to content

Custom Edges, BlowBaseEdge & Edge Toolbar

An EdgeTemplate draws every edge itself: BlowBaseEdge lays down the path and its arrowheads in a colour taken from the edge's data, and BlowEdgeText puts the label on a plate of the same colour. Selecting an edge opens a BlowEdgeToolbar to recolour or delete it.

yes no done
Start
Branch
Branch
End
Arrow keys move the view, Home shows the whole flow.
bit Blow

Try it

  • Click an edge to select it: it thickens, and a toolbar opens above its label. ๐ŸŽจ gives it the next colour - path, arrowheads and label plate together - and ร— deletes it.
  • Untick Pass on arrowheads: the edges lose their heads, although every edge still asks for one. Tick it again and the yes edge has one at each end.
  • Untick Coloured label plates to fall back to BlowBaseEdge's own label on the theme's plate.
  • Tick Wide hit area, then click a little beside an edge: it is selected from further away than before.
  • Drag from a handle to another node: the line you drag is a smooth step, and the new edge is drawn by the same template, in the theme's colour until you recolour it.

How it works

  • EdgeTemplate receives a BlowEdgeContext per edge - the Edge, its computed Path and label point (LabelX, LabelY), and MarkerStartUrl/MarkerEndUrl - and renders SVG. Around it the canvas still draws the focusable, selectable edge group and its own invisible click path.
  • BlowBaseEdge takes the Path, a Stroke (here from Edge.Data) and StrokeWidth (1.5 by default; 2 here, 3 when selected).
  • MarkerStart and MarkerEnd take a url(#...) reference: passing the context's on draws the heads the edge's MarkerStart and MarkerEnd ask for, in the edge's stroke colour; passing null draws none.
  • InteractionWidth (14) is the width of BlowBaseEdge's invisible click path, in screen pixels at any zoom. The canvas's own click path, BlowEdge.InteractionWidth wide, stays underneath, so only a wider value makes a difference.
  • BlowEdgeText draws a label at any point: X, Y and Label, with Style for the text, BgStyle for the plate, and PaddingX, PaddingY and BorderRadius to shape it (4, 2 and 3 by default). BlowBaseEdge's Label uses it with those defaults.
  • EdgeLabelTemplate renders HTML at each label point in a layer that is not zoomed, so the toolbar keeps its size; BlowEdgeToolbar styles it and keeps its clicks from reaching the pane.
  • DefaultEdgeType and ConnectionLineType make the edges you draw, and the line you draw them with, smooth steps.
An unhandled error has occurred. Reload 🗙