Event Reference
Every event BlowCanvas raises, wired to one canvas and logged under it with its payload - the quickest way to find out which event answers your question, when it fires and what it carries. Repeats are merged into one line with a count, and the three noisiest families stay off until you tick them.
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
- Look at the bottom of the log: OnInit and OnNodesInitialized were raised as the page opened, once the canvas had rendered and measured its nodes.
- Hover a node or an edge for its mouse-enter and mouse-leave events; tick Node and edge mouse moves to see the moves between them. Move onto and off the canvas for OnPaneMouseEnter and OnPaneMouseLeave; tick Pane mouse moves for OnPaneMouseMove.
- Click, double-click and right-click a node, an edge and the empty background. No browser menu opens over the canvas.
- Drag a node: OnNodeDragStart, one OnNodeDrag line counting the moves, OnNodeDragStop, then the edit's NodesChanged, OnGraphChanged and OnHistoryChanged.
- Drag the background to pan and scroll to zoom: OnMoveStart, OnMoveEnd, OnViewportChanged and OnPaneScroll. Tick Viewport moves for the stream of OnMove in between. Resize the browser window for OnPaneResize.
- Shift+drag a box round two nodes for OnSelectionStart, OnSelectionChange and OnSelectionEnd; drag one of them for the selection-drag events, and right-click one for OnSelectionContextMenu.
- Drag from a handle to a handle of another node: OnConnectStart, OnConnectionChange while the line follows the pointer, OnConnect and OnConnectEnd. Let go on empty space instead and there is no OnConnect, and OnConnectEnd says the drop was not valid.
- Click an edge to select it, then drag one of the dots at its ends to another handle: OnReconnectStart, OnReconnect and OnReconnectEnd.
- Click "Resize me" to select it and drag a corner or a side: OnNodeResizeStart, OnNodeResize and OnNodeResizeEnd.
- Select something and press Delete: OnNodesDelete, OnEdgesDelete and OnDelete. Ctrl+Z (Cmd+Z) brings it back.
- Select a node and press Ctrl+C then Ctrl+V (Cmd on a Mac) for OnPaste.
- Click Add a broken edge: it points at a node that does not exist, and OnError reports it. Clear log empties the log.
How it works
- Node pointer events carry a
BlowNodeMouseEvent- theNodeand the DOMEvent(MouseEventArgs:ClientX,ClientY, the modifier keys) - exceptOnNodeClick, which carries theBlowNode. Edge events match withBlowEdgeMouseEvent(Edge,Event) andOnEdgeClick'sBlowEdge. - Pane events carry the
MouseEventArgs;OnPaneScrollcarries theWheelEventArgs(DeltaX,DeltaY) of every wheel event, before it pans or zooms. - The canvas only listens for node and edge mouse moves, enters, leaves, double-clicks and context menus, and for pane mouse moves, while a handler is supplied. The checkboxes pass a
defaultEventCallbackwhen off, which takes the DOM listener away rather than merely ignoring what it hears. - A handled
OnNodeContextMenu,OnEdgeContextMenuorOnSelectionContextMenusuppresses the browser's menu;OnPaneContextMenudoes not, so the page wraps the canvas in an element with@oncontextmenu:preventDefault. - Drag and resize events carry the live
BlowNodegrabbed, itsPosition,WidthandHeightalready updated. A drag moving several nodes adds theBlowSelectionMouseEventevents (Nodes,Event). The start events are raised at the press, so a plain click on a node logs a drag start and stop too. OnMoveStart,OnMove,OnMoveEndandOnViewportChangedcarry theBlowViewport(X,Y,Zoom);OnPaneResizethe pane's newBlowDimensions(Width,Height).OnSelectionStartandOnSelectionEndcarry thePointerEventArgsof the box;OnSelectionChangeaBlowSelectionChange(Nodes,Edges).OnConnectStartcarries aBlowConnectionStartInfo(NodeId,HandleId,HandleType);OnConnectionChangeaBlowConnectionLineContext(From,To,IsValid), andnullonce it ends;OnConnectaBlowConnection(Source,Target,SourceHandle,TargetHandle);OnConnectEndaBlowConnectEndInfo(IsValid,IsDropped,IsReconnect,FlowPosition,Rejection).- Reconnecting raises
BlowEdgeReconnectStart(Edge,MovingEnd),BlowEdgeReconnect(Edge,Connection) andBlowEdgeReconnectEnd(Edge,MovingEnd,Rewired);EdgesReconnectableis on by default. - Deleting raises
OnNodesDelete(IReadOnlyList<BlowNode>),OnEdgesDelete(IReadOnlyList<BlowEdge>) andOnDelete(aBlowSelectionChangeof what went). - After every completed edit
NodesChangedandEdgesChangedhand back the live lists, andOnGraphChangedaBlowGraphChange(Kind,Origin,Label,Nodes,Edges,RemovedNodes,RemovedEdges). WithHistoryEnabled,OnHistoryChangedcarries aBlowHistoryState(CanUndo,UndoDepth,UndoLabel...); withClipboardShortcutsEnabled,OnPastecarries the pastedBlowFragment(Nodes,Edges). OnInitcarries theBlowCanvasitself, once, after the first render and measurement;OnNodesInitializedcarries nothing;OnErrorcarries aBlowError(Code,Message), once for each distinct problem.- "Resize me" has a
BlowNodeResizerin its template; the other nodes fall back toBlowDefaultNode. The page merges a repeating event into one line with a count, so a drag is one line rather than fifty.