DevTools
Inspector panels in the spirit of React Flow's DevTools, built from the canvas's own events: a live viewport readout from OnMove, a node inspector that follows every drag, and a change log fed by OnGraphChanged - one entry per completed edit, saying what kind it was, what made it and what it touched.
Viewport
x: 0, y: 0, zoom: 1.00
Node Inspector
1 input (250, 20)
2 default (150, 160)
3 output (380, 160)
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 the background to pan and scroll to zoom: the Viewport panel follows every step.
- Drag a node: its position in the Node Inspector follows the pointer, and when you let go the log gets one
Movedentry, not one per step. - Click a node (or Shift+click several): the inspector stars the selected ones and the log notes the new selection.
- Drag from a handle to another node to connect them, then select something and press Delete: the log shows a
Connectedand aRemovedentry, by the user. - Press Add node: the log shows an
Addedentry made through the API, and the node joins the inspector. - Press Ctrl+Z and Ctrl+Y on the canvas: undo and redo appear as
Replacedentries from the history. Clear log empties the log.
How it works
OnMovereports the viewport on every step of a pan or zoom, so the Viewport panel is live;OnViewportChangedwould report a drag-pan only once it ends.OnNodeDragis raised on every pointer move of a drag. The page does nothing in it but re-render, which is all the inspector needs to read the movingPosition.Measuredis the size the canvas measured in the browser - empty until a node has been laid out, so the inspector shows a size only from then on - andSelectedthe node's selection state; both are kept up to date on the live node.OnNodesInitialized, raised once every node has been measured, re-renders the inspector with the first sizes.OnGraphChangedis raised once per completed edit with aBlowGraphChange:Kind(Added,Removed,Moved,Resized,Connected,Reconnected,ReplacedorEdited),Origin(User,Api,HistoryorRemote),Label, and theNodes,Edges,RemovedNodesandRemovedEdgesit touched. It is the place to save, validate or sync.OnSelectionChangereports the selected nodes and edges; selecting is not an edit, so it never reachesOnGraphChanged.AddNodes(node)appends a node through the API, andHistoryEnabledturns on undo and redo, whose steps come back asReplacedchanges.BlowPanelpins the two panels to the pane's corners withAnchor; the log sits under the canvas, where it can grow without covering nodes.