Share Posted July 1, 2022 So, I'm using Draggable to move around a map that is larger than the viewport and bound to a container. That works perfectly. I have hotspots on the map that reveal info cards. When I click a hotspot, I would like to programmatically perform a drag as if I manually dragged the map from the "mousedown point" to the center of the screen. .to() works fine but doesn't respect the Draggable bounds (for obvious reasons). Is there a way to pass coordinates to a Draggable method such that it respects everything about the Draggable instance (bounds, inertia, etc.)? Thanks Superheros! Link to comment Share on other sites More sharing options...
Share Posted July 1, 2022 Got a minimal demo? No, there's not a simple way to tell a Draggable instance "hey, pretend the user is interactively dragging...but I'm actually doing it all programmatically" other than maybe faking a bunch of events dispatched by the element (sounds like a bad idea). I believe you could, however, tap into the Draggable's maxX, minX, maxY, and minY properties if you want to clamp the to() tween values accordingly. 1 Link to comment Share on other sites More sharing options...
Author Share Posted July 1, 2022 9 minutes ago, GreenSock said: Got a minimal demo? LOL, no! 🤣 I was just wondering if the was an under-the-hood (undocumented) method 1 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