Click Distance
A hand on a mouse or a finger on a screen wobbles. NodeClickDistance and PaneClickDistance set how far the pointer may travel between press and release and still count as a click, so OnNodeClick and OnPaneClick are not lost to a shaky hand; NodeDragThreshold sets how far it must travel before the node starts to move.
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
- Click a node: node clicks goes up and last names it. Click the empty background: pane clicks goes up.
- Press a node, move a few pixels and let go: the node moves (node moves goes up) and it still counts as a click, because the pointer stayed within the node click distance (20 px to begin with).
- Drag a node further than that: it moves, but no click is reported. Do the same on the background: past the pane click distance the press was a pan, not a click.
- Drag Node click distance or Pane click distance to 0 and even the slightest wobble stops being a click; raise them and longer slips still count.
- Raise Drag threshold to the node click distance: now a small wobble neither moves the node nor stops being a click - the node only moves once the press is clearly a drag.
How it works
NodeClickDistance(3 px by default; 20 here) is how far the pointer may travel during a press on a node and still raiseOnNodeClickwith theBlowNodeon release.PaneClickDistance(3 px; 20 here) does the same forOnPaneClickon the empty pane, which carries theMouseEventArgs. Past it the press was a pan, and a click that would also have cleared the selection does nothing.NodeDragThreshold(1 px) is how far the pointer must travel before the node starts to follow it. It is independent of the click distance, so with the defaults a press that moves 2 px both moves the node and is a click.- All three are measured in screen pixels, so they feel the same at any zoom.
OnNodeDragStartandOnNodeDragStopare raised for every press on a draggable node, moved or not; the page compares the node'sPositionbetween the two to count the presses that actually moved it.