DroidsOnRoids / SwiftCarousel

Lightweight, written natively in Swift, circular UIScrollView.
http://www.thedroidsonroids.com/blog/ios/circular-scroll-view-swiftcarousel/
MIT License
144 stars 43 forks source link

Fix issue #7 #12

Closed sunshinejr closed 8 years ago

sunshinejr commented 8 years ago

Hey all! I'm really happy to say that I've (probably and hopefully) fixed issue #7! 🎉🎉🎉 There was a problem when sometimes the carousel wouldn't scroll to specific target, but would have a little offset and would be a little off the center position. What I think happened was that when you long scrolled (and the circle started spinning) the velocity was let's say X. Then we scroll again, even tho the carousel didn't stop, and our velocity is still != 0. Then we would calculate position based on current contentOffset, which sounds like a good idea. What happens is that the velocity doesn't erase itself, it will still move our image a little even tho we started another scroll. So I've made some checks and if we scroll while we are already scrolling, let's add the velocity that's left and made calculations based on the result. It seems that's working fine and I'm really happy about that!