Skip to content

Multi Flows

Two BlowCanvas instances on one page, each with its own nodes, edges, viewport, selection, clipboard and add-ons - nothing is shared unless the page shares it. Copying a selection from one into the other is a single call on each canvas.

A · 1
A · 2
Flow A
bit Blow
B · 1
B · 2
B · 3
Flow B
bit Blow

Try it

  • Drag the background or scroll in one flow, or use its control bar: only that flow pans and zooms.
  • Click a node in Flow A, then one in Flow B: each flow keeps its own selection. Drag or Delete in one and the other is untouched.
  • Select nodes in Flow A (Shift+drag the background for several) and press Copy A's selection to B: copies land in Flow B, with the edges between them, and Flow B fits them in view. The other button copies the other way.
  • Select a node in Flow A, press Ctrl/Cmd+C, click into Flow B and press Ctrl/Cmd+V: nothing is pasted, because each canvas has a clipboard of its own. Ctrl/Cmd+V back in Flow A pastes the copy there.

How it works

  • Each BlowCanvas is a self-contained instance: its own Nodes and Edges lists, viewport, selection, measuring and keyboard handling. The BlowBackground, BlowControls and BlowPanel inside a canvas belong to that canvas alone, so the two control bars steer different flows.
  • AriaLabel gives each flow a name of its own ("Flow A", "Flow B") for screen readers, instead of two regions both called "Flow diagram".
  • ClipboardShortcutsEnabled binds Ctrl/Cmd+C, X, V and D on each canvas. The clipboard lives in the canvas, in memory, so a copy made in one flow is not in the other.
  • The toolbar crosses that boundary on purpose: source.Copy() returns the selection as a BlowFragment - the selected nodes and every edge between two of them - and target.PasteAsync(fragment) adds fresh copies with new ids (a1-copy, ...), offset by the target's PasteOffset and selected. FitViewAsync(300) then brings them into view.
  • Copy() with nothing selected hands back whatever that canvas copied last, so the page checks for a selection first.
An unhandled error has occurred. Reload 🗙