retejs / rete

JavaScript framework for visual programming
https://retejs.org
MIT License
10.17k stars 653 forks source link

Prevent context-menu click from initiating node drag #404

Closed kswenson closed 4 years ago

kswenson commented 4 years ago

When not using the context-menu-plugin, clicking the right mouse button brings up the browser context menu (as expected) but also initiates a node drag which can result in the node being "stuck" to the mouse until the mouse button is clicked again. When using the context-menu-plugin, right-click-dragging with the mouse down allows the node to be dragged in addition to the rete context menu being presented. Similarly, on my mouse (on a Mac) the center scroll-wheel button can also be used to drag a node while simultaneously invoking the default center scroll-wheel behavior. The proposed fix here is to limit node drags to the primary mouse button when the input device is a mouse. I looked into the possibility of adding tests as suggested by the guidelines but there don't seem to be any tests for the drag/click behaviors so I wasn't sure how best to go about it.

kswenson commented 4 years ago

Note: the Travis build is failing for reasons that seem unlikely to be specifically related to this PR:

sonar-scanner: command not found
The command "npm run coverage && sonar-scanner" exited with 127.