visjs / vis-network

:dizzy: Display dynamic, automatically organised, customizable network views.
https://visjs.github.io/vis-network/
Apache License 2.0
3.04k stars 371 forks source link

clickToUse: mouseDown instead of mouseUp #41

Open whme opened 5 years ago

whme commented 5 years ago

Hey, the clickToUse option is really helpfull and overall a nice feature. Especially if the graph is embedded in a page where you have to scroll so you can scroll through the page without accidently zooming in or out the graph. However, if one wants to move around elements in the graph and has to select it first it just feels bad. So instead of having the graph selected once the users click is done (so on the MouseButtonRelease or MouseButtonUp event) it would be nice to have it select already on the MouseButtonPress or MouseButtonDown event. An option where you can switch between default and "new" behavior would maybe be the best.

Thomaash commented 5 years ago

This won't be that simple. Click to use is based on overlay that swallows events. The mouse down would be swallowed by the overlay anyway and another mouse down would be necessary to drag nodes around. This would require either synthetic events (these could be a bit tricky) or complete overhaul of click to use.