Dos Posted April 25, 2018 Share Posted April 25, 2018 Hello everybody, I'm currently trying to get a mesh by clicking on the canvas. So far, it works really great but I still have a problem: On click, the mesh gets highlighted. Fine but when I drag the mouse on the canvas in order to move the cam, when I release the button of the mouse, a click event is triggered and the mesh beneath it get selected. I tried to add an event listener on 'mouseup' to stop propagation to the click event but it seems BJS already "intercepts" this event so it is never triggered. I created a codepen to illustrate : https://codepen.io/3dos/pen/mLEEdq On the left is an empty canvas on which the mouse events are triggered. On the right is a babylon canvas on which the mouseup event is not triggered. Is there a simple way to avoid selecting meshes on drag ? (also tried the dragend event with no success either) Thanks to everybody who already helped me PS: I joined a screenshot of the console illustrating what I'm telling (did the exact same actions on the 2 canvas) Quote Link to comment Share on other sites More sharing options...
JohnK Posted April 25, 2018 Share Posted April 25, 2018 Hi @Dos and welcome to the forum from me. Have you checked out the drag and drop playground demo https://www.babylonjs-playground.com/# then choose drag and drop from the drop down menu top right (should say basic scene). Dos 1 Quote Link to comment Share on other sites More sharing options...
Dos Posted April 25, 2018 Author Share Posted April 25, 2018 Thank you very much JohnK (for the welcome message and the help) Looks like this is what I was searching for Just a little note about that for every dev landing on this question : don't forget to use PEP in order to have this working on Safari as it doesn't support pointer events yet Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.