API: onMouseDown, onMouseUp and onClick
in Getting Started
•
9 years ago
Do you think it would be nice to add to those pages of API an explanation telling people the differences between them?
It would be something like this:
It would be something like this:
onMouseDown will trigger when either the left or right (or middle) is pressed. Similarly, onMouseUp will trigger when any button is released. onMouseDown will trigger even when the mouse is clicked on the object then moved off of it, while onMouseUp will trigger if you click and hold the button elsewhere, then release it above the object.
onClick will only trigger when the left mouse button is pressed and released on the same object. In case you care about order, if the same object has all 3 events set, it's onMouseDown, onMouseUp, then onClick. Each even should only trigger once though.
1