Skip to content

Floating Edges

Edges that meet each node's border wherever it faces the other node, instead of a fixed handle, and slide round it as you drag. An EdgeTemplate asks BlowGraphUtils.GetFloatingEdgeParams for the two border points and sides and draws the path through them; with every node one big handle and BlowConnectionMode.Loose, you connect from anywhere inside a node to anywhere on another.

N1
N2
N3
N4
N5
N6
Arrow keys move the view, Home shows the whole flow.
bit Blow

Try it

  • Drag a node round the centre one: each edge slides along both borders so it always leaves and arrives on the facing sides, arrowhead included.
  • Press inside a node - within its dashed outline - and drag onto another node to connect them. The whole inner area is a handle, and the new edge floats like the others.
  • Press the thin rim between the dashed outline and the node's edge to drag the node instead of connecting.
  • Pick another Edge path: the edges and the line drawn while you connect take that shape, still anchored to the borders.
  • Tick Show anchor points to mark where each edge meets a node, labelled with the side of the node it leaves through; drag a node and watch the sides change.
  • Click an edge to select it - it thickens - and press Delete to remove it.

How it works

  • EdgeTemplate replaces the built-in edge. It receives a BlowEdgeContext and draws SVG; here a BlowBaseEdge with a path of the page's own, which keeps the library's wide hit area, selection styling and the edge's arrowhead (MarkerEnd="@ctx.MarkerEndUrl"; BlowEdge.MarkerEnd is on by default).
  • BlowGraphUtils.GetFloatingEdgeParams(source, target) returns the point on each node's border that faces the other and the side it is on. It is built from two public helpers, which the anchor points call one by one: GetNodeIntersection(node, other) - where the line between the two centres crosses the node's border - and GetEdgePosition(node, point) - which side that point is on. BlowEdgeText writes the side's name on a plate beside each point.
  • BlowEdgePath.Compute(type, sourceX, sourceY, sourceSide, targetX, targetY, targetSide) turns the points and sides into an SVG path, the same geometry the built-in edges use; the Edge path select picks the BlowEdgeType.
  • The helpers meet each node's bounding box, which is why the nodes are rounded squares: on a circle the edges would stop short of it on the diagonals.
  • Each node has one BlowHandle, stretched over all but a 10-pixel rim with its Style. All the handles are sources, which only ConnectionMode="BlowConnectionMode.Loose" lets connect to one another.
  • ConnectionLineTemplate draws the line while you connect in the chosen path type; BlowMiniMap's NodeColorFunc paints each node its own colour on the map.
  • The node's Class (fl-shell) strips the default node chrome - padding, border, background, minimum width - so the template's square fills it edge to edge.
An unhandled error has occurred. Reload 🗙