When I use bind function from the react-use-gesture on a mesh, then the mouse down events on the mesh are overridden by the bind event. And usegesture is only taking only left click events.
I tried adding mousedown events on mesh but it didn't work
When I use bind function from the react-use-gesture on a mesh, then the mouse down events on the mesh are overridden by the bind event. And usegesture is only taking only left click events.
I tried adding mousedown events on mesh but it didn't work
Copyright © 2021 Jogjafile Inc.
I was able to get this to work by using the button property on the event. In my case, I am using the
useGesturehook, like this:I couldn't find an example in their documentation, but I did find a part of the config called
pointer.buttonshere that can be used for the drag configuration. The docs mention that this allows the drag to be triggered by buttons other than the left click, and has a link to the MDN Web Docs, MouseEvent: buttons property. SinceuseGesturepasses the event back in the state asstate.event, we can then detect which mouse button was used by checking the value ofstate.event.button.This is the list of possible button values: