brianzinn / react-babylonjs

React for Babylon 3D engine
https://brianzinn.github.io/react-babylonjs/
818 stars 105 forks source link

useClick hook fires after "onmousedown" rather than after "onmouseup" #147

Closed joenye closed 3 years ago

joenye commented 3 years ago

As described in the Web API docs, a click event "fires after both the mousedown and mouseup events have fired, in that order."

The current useClick hook uses the OnPickTrigger, which is fired "when the user touches/clicks on a mesh.". This appears to be roughly equivalent to running after the mousedown event, but before the mouseup event.

I propose modifying the useClick hook to use the OnPickUpTrigger instead, as this seems to more closely align with standard click behavior.

joenye commented 3 years ago

Actually, never mind. I just realised OnPickTrigger is the correct trigger to use, I just had a bug in my code!