Edge Toolbar
Selecting an edge opens a BlowEdgeToolbar at its midpoint, drawn through EdgeLabelTemplate so it keeps the same size at any zoom: a text box renames the edge, one button recolours it and another deletes it.
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
- Click an edge: a toolbar opens just above its label, and closes again when you click the empty pane.
- Type in the toolbar's box: the edge's label changes as you type. Backspace in the box edits the text; it does not delete the edge.
- ๐จ gives the edge the next colour in a short palette; the line and its arrowhead change, and the selection shows as a thicker line rather than the selection colour, so the new colour stays visible.
- ร deletes the edge.
- Scroll to zoom with an edge selected: the edge grows and shrinks, the toolbar keeps its size.
- Drag from a node's bottom dot to another node's top dot to add an edge, then select it: it has the same toolbar. Reset edges puts the starting edges back.
How it works
EdgeLabelTemplaterenders HTML at each edge's label point in an overlay that is not zoomed; this one renders nothing unlessctx.Edge.Selected.BlowEdgeToolbaris a styled container (Class,Style) that keeps its presses, clicks and right-clicks from reaching the pane, so its buttons and text box work without thenopanclass and pressing them leaves the edge selected.- While focus is in a text box the canvas ignores its graph keys, so typing never deletes or moves anything.
- The
EdgeTemplatedraws each edge withBlowBaseEdgein the colour kept in the edge'sData, passesctx.MarkerEndUrlon for the arrowhead, and sets a--edge-colourcustom property that a page style uses for the selected edge. - The buttons change the
BlowEdgein place -Label,Data- or remove it from theEdgeslist; the canvas draws the change on the next render.