Skip to content

When dragging a node, don't snap its top-left corner to the cursor

Mathias Rav requested to merge rav/helvum:nicer-node-dragging into main

Revamp the node dragging implementation, moving it into the GraphView widget.

When a drag is initiated, the node widget's current position is stored. Whenever the drag gesture is updated, the node widget's position is set by adding the relative drag vector to the position at the start of the drag.

A drag gesture on the node widget rather than the GraphView widget was considered, but this seems to lead to a weird flickering effect when the node is moved while the drag gesture on the node is active.

To avoid interfering with the drag handlers on the ports, check if the GraphView drag gesture targets a port, in which case the handler does nothing.

Merge request reports

Loading