Interaction
Every way the canvas takes input is a BlowCanvas parameter: dragging, connecting and selecting, panning with a drag or the wheel, and zooming. Switch them on the toolbar and try the canvas to feel each one - the usual reason is a flow that has to sit quietly inside a page, or a read-only view.
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
- Untick Nodes draggable: pressing a node still selects it, but it no longer moves.
- Untick Nodes connectable: dragging from a handle (the dot on a node's edge) no longer draws a connection.
- Untick Selectable: clicks and Shift+drag no longer select anything, so Delete has nothing to remove.
- Untick Pan on drag: dragging the background no longer moves the view; the wheel and the control bar still do.
- Pick Pan buttons to choose which mouse buttons pan when dragged on the background: add the middle button, or the right one too.
- Untick Zoom on scroll: the canvas ignores the wheel, so scrolling over it scrolls the page instead; Ctrl+wheel (how a trackpad pinch arrives) still zooms.
- Tick Pan on scroll: the wheel pans the view, Shift+wheel pans it sideways, and Ctrl+wheel still zooms. Scroll axis locks the wheel to one direction and Scroll speed scales how far each notch travels.
- Untick Zoom on double-click: double-clicking the background no longer zooms in (with it on, Shift+double-click zooms out).
- Untick Keep the page still, then scroll over the canvas: it zooms and the page scrolls along with it.
How it works
NodesDraggable,NodesConnectableandElementsSelectable(alltrue) switch dragging, connecting and selecting for the whole flow; a node or edge can still opt out alone with its ownDraggable,ConnectableorSelectable.PanOnDrag(true) lets a drag on the empty pane pan;PanButtons([0]) lists the mouse buttons that do it - 0 left, 1 middle, 2 right. The page passes[0, 1]or[0, 1, 2].OnPaneContextMenudoes not cancel the browser's menu, so while the right button pans the page wraps the canvas in an element with@oncontextmenu:preventDefault.ZoomOnScroll(true) zooms toward the cursor on the wheel.PanOnScroll(false) takes the wheel over for panning;PanOnScrollMode(BlowPanOnScrollMode.Free, orHorizontal/Vertical) restricts it to one axis, andPanOnScrollSpeed(0.5) multiplies the wheel's distance.ZoomOnDoubleClick(true) zooms in by 20% about the point double-clicked, and out with Shift held.PreventScrolling(true) cancels the page scroll for a wheel the canvas acts on. A wheel it does not act on - zooming off, or aZoomActivationKeythat is not held - always reaches the page.- None of these touch the control bar: its buttons zoom and fit the view whatever is switched off.