fionchadd Posted September 17, 2021 Share Posted September 17, 2021 Hi there, I'm trying to work with Draggable at the moment and I'm having an issue with the snap function. I'm trying to get the item to return to its original position after it's been thrown; currently the snap value seems to be affecting the X value but not the Y value and I'm not really sure why? Any advice you can give would be greatly appreciated! Thanks Hannah See the Pen XWgZXgL by fionchadd (@fionchadd) on CodePen Link to comment Share on other sites More sharing options...
OSUblake Posted September 17, 2021 Share Posted September 17, 2021 Welcome to forums @fionchadd Standby while we look into this issue. In the meantime you can use a function for snap. snap: { x: () => 0, y: () => 0 }, Link to comment Share on other sites More sharing options...
Solution GreenSock Posted September 17, 2021 Solution Share Posted September 17, 2021 That was related to an obscure bug in InertiaPlugin related to Array-based end values which should be fixed in the next release. Preview on CodePen at https://assets.codepen.io/16327/InertiaPlugin.min.js (clear your cache first) I'd also strongly recommend just using one timeline and restart() it in the onDragEnd because it'll be far more efficient than re-creating all those tweens every time. You can use defaults on the timeline to reduce your code too: See the Pen abwqVVa?editors=0010 by GreenSock (@GreenSock) on CodePen 2 Link to comment Share on other sites More sharing options...
fionchadd Posted September 17, 2021 Author Share Posted September 17, 2021 Hi Jack, ah that’s amazing, thanks so much for the advice! I’m still pretty new to gsap so that’s super helpful to know. Also cant believe I found a real life bug lol, I was convinced I was doing something wrong 😅 thanks for your help! hannah 2 Link to comment Share on other sites More sharing options...
Cassie Posted September 18, 2021 Share Posted September 18, 2021 Congratulations Hannah! Top tier bug hunting! 1 2 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