Floating Edges
Floating edges ignore the handles and attach to the point on each node's border that faces the other node, worked out again on every render. An EdgeTemplate asks BlowGraphUtils.GetFloatingEdgeParams for the two points and sides, and BlowEdgePath.Compute turns them into a path of any type.
Press Tab to move between the nodes and edges of the diagram.
Press Enter or Space to select it, Shift with Enter to add it to the selection, the arrow keys to move the selected nodes, Delete to remove them and Escape to clear the selection. Press C to start a connection from it.
Press Enter or Space to select it, Delete to remove it and Escape to clear the selection.
bit BlowTry it
- Drag any outer node round N5: its edge slides along both borders, always joining the two points that face each other.
- Drag N5 itself past the others: all four edges move to the sides that now face it.
- Switch Path between Bezier, SimpleBezier, Straight, Step and SmoothStep: the same two points, joined by each algorithm.
- Hover a node to show its two connection dots, then drag from one to another node: every dot that would take the connection lights up, and the new edge floats like the rest.
How it works
BlowGraphUtils.GetFloatingEdgeParams(source, target)returns where the line between the two nodes' centres crosses each node's bounding box, and which side of the node that is (Source,SourcePos,Target,TargetPos).BlowEdgePath.Compute(type, sx, sy, sourcePos, tx, ty, targetPos, options)runs any built-in path algorithm between two points and returns aBlowPathResult- the SVGPathand the label point. The edge's ownPathOptionsgo in as the last argument, so tuning an edge still works.- The
EdgeTemplatehands that path toBlowBaseEdgeinstead of the handle-to-handlectx.Path, and passesctx.MarkerEndUrlon so the edges keep their arrowheads. - The geometry meets each node's bounding box, so the nodes are rounded squares rather than circles, whose borders the edges would stop short of on the diagonals.
ConnectionMode.Looselets a connection start or end on either dot, since the handle it uses does not decide where the edge attaches.EdgesReconnectableis off for the same reason.