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.
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. Press C to move its end to another node.
bit BlowTry 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
EdgeTemplatereplaces the built-in edge. It receives aBlowEdgeContextand draws SVG; here aBlowBaseEdgewith 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.MarkerEndis 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 - andGetEdgePosition(node, point)- which side that point is on.BlowEdgeTextwrites 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 theBlowEdgeType.- 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 itsStyle. All the handles are sources, which onlyConnectionMode="BlowConnectionMode.Loose"lets connect to one another. ConnectionLineTemplatedraws the line while you connect in the chosen path type;BlowMiniMap'sNodeColorFuncpaints 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.