MR FIX IT Posted August 14, 2022 Share Posted August 14, 2022 Hello , I have a question on Whether its possible to listen to another event (right click) while I'm on the onDrag with a draggable.Create Thanks in advance . Link to comment Share on other sites More sharing options...
GreenSock Posted August 14, 2022 Share Posted August 14, 2022 I'm not sure what you mean. By default, Draggable has allowContextMenu set to false so that right-clicking (which normally brings up the context menu in the browser natively) doesn't interfere. You can set it to true if you prefer. Link to comment Share on other sites More sharing options...
GreenSock Posted August 14, 2022 Share Posted August 14, 2022 Also, you can call .endDrag() anytime. Link to comment Share on other sites More sharing options...
MR FIX IT Posted August 15, 2022 Author Share Posted August 15, 2022 9 hours ago, GreenSock said: I'm not sure what you mean. By default, Draggable has allowContextMenu set to false so that right-clicking (which normally brings up the context menu in the browser natively) doesn't interfere. You can set it to true if you prefer. just to clarify my question I want add an add event listener during the onDrag event so while I'm dragging my element if I right clicked I re-place the draggable element where it was ... is there a way of doing that?? Link to comment Share on other sites More sharing options...
Cassie Posted August 15, 2022 Share Posted August 15, 2022 Heya, thanks for being part of Club GreenSock 🥳! You can still use normal event listeners alongside Draggable. Not everything has to be done with the methods available to you from GSAP. I guess you'd just need a way to tell if the user is dragging and then listen for right clicks and check that. I assume as Jack said that allowContextMenu would have to be true so that the event fires and then in the event listener you'd have to prevent default to avoid the popup menu... Maybe this sort of thing will work? I can't actually test it to see though because I'm using a touchpad at the moment - so I can't drag and right click simultaneously.(Probably a little sign that you shouldn't be hiding functionality behind this interaction as it's not going to be possible for every user) See the Pen YzaJdKv?editors=0010 by GreenSock (@GreenSock) on CodePen Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now