Custom Connection Line
The line drawn while you connect can be restyled with ConnectionLineStyle and ConnectionLineClass, or drawn entirely by you with a ConnectionLineTemplate - here a dashed gradient with a dot at the pointer that turns green over a handle that would accept the connection.
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 from the handle under "Drag from here" (or from any node's bottom handle) and move around: the line follows the pointer.
- Bring the pointer near the top handle of Node B or Node C: with the custom template, the gradient's far end and the dot at the pointer turn green, because releasing there would connect.
- Switch Line to Default, restyled for the built-in line in a thicker amber stroke with marching dashes, or to Default for the line as it comes.
- Change Shape to draw the line as a bezier, smooth step, step or straight line - whichever line is shown.
How it works
ConnectionLineTemplateis aRenderFragment<BlowConnectionLineContext>drawn inside the canvas's SVG, in flow coordinates, instead of the built-in line. Here it is a page field handed over only while Custom template is picked; null brings the built-in line back.- The context carries
FromNode,FromHandle,FromHandleType, the start pointFromand its sideFromPosition, the pointerToand the sideToPositionthe line arrives from, andIsValid- true when releasing now would connect, including withinConnectionRadiusof a handle that would accept it. BlowEdgePath.Compute(type, ...)turns those points and sides into an SVG path, the same geometry edges use; the template passes it the Shape. The gradient usesgradientUnits="userSpaceOnUse"so it always runs from the handle to the pointer.- For the built-in line,
ConnectionLineType(defaultBezier) picks the shape,ConnectionLineStyleadds an inline style -stroke:#f59e0b;stroke-width:3here - andConnectionLineClassa class of your stylesheet, this page'sccl-marching. All three are ignored while a template draws the line.