Skip to content

Selection Gestures

Everything about making and using a selection: which key opens a selection box and which one adds to a selection, what the box picks up, and the events for the box, for dragging several nodes as one (OnSelectionDragStart, OnSelectionDrag, OnSelectionDragStop) and for right-clicking a whole selection (OnSelectionContextMenu).

Read
Parse
Filter
Reduce
Write
bit Blow

Try it

  • Shift+drag across the background to draw a selection box round a few nodes: the log shows the box starting and ending, and what it selected.
  • Switch Box picks to Full and draw again: only nodes entirely inside the box are picked, not every node it touches. Untick Box selects edges and the box leaves the edges between the picked nodes unselected.
  • Drag one of the selected nodes: they all move together, and the log shows one selection drag - with how many OnSelectionDrag moves it took - next to the drag of the node you grabbed. Drag a node that is not selected: only it moves, and only a node drag is logged.
  • Right-click one of several selected nodes: the log shows the node's menu event and then the whole selection's. Right-click a node on its own and only the node's event comes. No browser menu opens over a node.
  • Change Selection key to Alt or Control and that key opens the box instead; with none, only a plain drag with Selection on plain drag ticked draws one.
  • Hold the Multi-select key and click nodes to add them one at a time; held while drawing a box, it adds the box's catch to the selection rather than replacing it.
  • Tick Selection on plain drag: now a drag on the background draws a box, and holding the Pan key (Space) turns it back into a pan. Pick none and the background can no longer be dragged to pan - the wheel and the control bar still move the view.

How it works

  • SelectionKey (BlowModifierKey.Shift) held turns a drag on the pane into a selection box; null leaves boxes to SelectionOnDrag (false), which makes every plain drag draw one.
  • PanActivationKey (" ", Space) held turns any drag on the pane into a pan, even with SelectionOnDrag; it is a KeyboardEvent.key name, and null disables it.
  • MultiSelectionKey (BlowModifierKey.Shift) adds a clicked node or edge to the selection, and makes a box add to it. Both keys default to Shift, so Shift+drag draws a box that adds.
  • SelectionMode (BlowSelectionMode.Partial) picks every node the box touches; Full only those it encloses. SelectEdgesOnSelectionBox (true) also picks the edges whose two nodes the box picked.
  • OnSelectionStart and OnSelectionEnd bracket a box with the PointerEventArgs of the press and the release; by the end the selection is final.
  • OnNodeDragStart, OnNodeDrag and OnNodeDragStop report the node grabbed, as a BlowNode. When more than one node moves, OnSelectionDragStart, OnSelectionDrag and OnSelectionDragStop report all of them as a BlowSelectionMouseEvent (Nodes, Event), so the group can be treated as one edit. The start events come at the press, so a stop with no moves since was a click.
  • OnNodeContextMenu (a BlowNodeMouseEvent) reports the node right-clicked; when it is one of several selected, OnSelectionContextMenu follows with the whole selection. Handling either suppresses the browser's menu over nodes.
An unhandled error has occurred. Reload 🗙