markuslerner / THREE.Interactive

Fast and simple interaction manager for three.js for enabling mouse and touch events on 3D objects
MIT License
178 stars 26 forks source link

Mouse click event bug? #21

Open isensen opened 1 year ago

isensen commented 1 year ago

Hello, I have a problem, I have bound the click event to object A. Then I pressed the left mouse button on a blank space but did not release it, then I dragged the mouse to rotate the space (added orbitcontrol), when the mouse is on object A and released the left mouse button, it will activate the click event of A. This caused me to inadvertently activate the event when I just wanted to rotate the space.

markuslerner commented 1 year ago

Hi @isensen, sorry for my late reply. It would be great, if you could provide some sample code, so that I can test that.

isensen commented 1 year ago

Hi @markuslerner , thank you very much for your answer, and sorry for my late reply, in fact the demo provided by the official website has this problem, the click event should be equal to mousedown & mouseup on the same object, otherwise, when I rotate the model randomly in space, it is easy to trigger some click events by mistake. Looking forward to your reply! demo

markuslerner commented 1 year ago

Thank you @isensen, now I know what you mean. One would need to check, if the mousedown event has been detected on that object before the click gets fired. I can implement this as soon as I find the time.

markuslerner commented 1 month ago

Hi @isensen, In version 1.8.0 you can now use the wasIntersectedOnMouseDown property on InteractiveEvent to determine, whether an event was started (mouse down, touch down) on that particular object.

Also see #27