-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat / swipe optimizations, features and fixes #54
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work, again better!
As discussed, still room for some improvement on mobile (iOS mostly?). I'm trying to fine-tune as well.
Quality Gate passedIssues Measures |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work 🎉 Thanks for the examples!
Superseded by #56 |
This PR is based on #47 with some additional improvements and features.
The main problem with the transition between the swipe velocity and animation is that the speed needs to correspond with the swipe speed. In other words, if a user swipes with a velocity of 5 pixels per frame, it should animate from 5 pixels per frame to zero.
Before, we calculated the approximate end index and animated it to that index. This caused the starting speed to mismatch with the swipe speed, which didn't feel right.
I also added two new features:
slide
,slideToIndex
, andslideToPage
methods)closest?: boolean
argument to theslideToIndex
function. Instead of sliding to the absolute index, it slides to the closest circular item indexThis PR also fixes a problem when there are no pages; the slider still animates, and the slide shows empty tiles or no tiles at all. Sliding is completely disabled no when there are no pages.
Update
I've just pushed an update with some improvements:
See https://66297348da698259008b816b--tile-slider-v2.netlify.app/