HTML Edge Labels & Drag Handles
An EdgeLabelTemplate turns every edge label into HTML - here with a delete button in it - drawn
in an overlay that keeps a constant size at any zoom. The purple nodes set UseCustomDragHandle,
so only the BlowDragHandle grip in their template moves them.
validate
emit
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 purple node by its ⠿ grip to move it. Dragging its body does not move it - a press there only selects it.
- Drag the plain node from anywhere on it, as any node without a custom drag handle.
- Click × on an edge's label to delete that edge.
- Scroll to zoom in and out: the nodes grow and shrink, while the labels and their buttons keep the same size on screen.
- Connect two nodes: the new edge has no
Label, so its HTML label shows the edge's id instead.
How it works
EdgeLabelTemplateis aRenderFragment<BlowEdgeContext>rendered as HTML at each edge's label point, in a layer above the graph that is not zoomed. Once it is set it replaces the built-in SVG labels.- The delete button carries
nodrag nopan: without them a press on it would start a pan, the pane would capture the pointer, and the click would never reach the button. It removes the edge from_edges, and the canvas drops it on the next render. UseCustomDragHandle = trueon a node stops its body from starting drags; only aBlowDragHandleinside its template does, and itsClassstyles the grip.- The plain node is handed back to
BlowDefaultNode, the built-in look, from the sameNodeTemplate. - Every node element carries
bit-blow-node-{Type}, so the page tints thepanelnodes with a.bit-blow-node-panelrule alone, mixed into--bit-blow-node-bgso it suits both colour modes. - The edges are a
SmoothSteppath and a bezier with a closed arrowhead (MarkerType = ArrowClosed).