Skip to content

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.

Node 1
Node 2
Node 3
Node 4
Arrow keys move the view, Home shows the whole flow.
bit Blow

Try 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, NodesConnectable and ElementsSelectable (all true) switch dragging, connecting and selecting for the whole flow; a node or edge can still opt out alone with its own Draggable, Connectable or Selectable.
  • 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].
  • OnPaneContextMenu does 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, or Horizontal / Vertical) restricts it to one axis, and PanOnScrollSpeed (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 a ZoomActivationKey that 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.
An unhandled error has occurred. Reload 🗙