zepojo / UPCarouselFlowLayout

A fancy carousel flow layout for UICollectionView on iOS.
MIT License
1.66k stars 236 forks source link

Fix issue #37 #45

Open Sulinskii opened 5 years ago

Sulinskii commented 5 years ago

scroll not smooth while scroll small space and release your hand quickly

rslowinski commented 5 years ago

I find it really helpful, thanks!

KirillKudaev commented 4 years ago

Thank you! Currently doesn't work on my very first cell for some reason. Works for every other one. Trying to investigate...

KirillKudaev commented 4 years ago

Solves some edge cases:


        let hasScrollingVelocity = isHorizontal ? (velocity.x != 0) : (velocity.y != 0)
let proposedContentOffsetCenterOrigin: CGFloat
if hasScrollingVelocity {
            let velocityDirectionMultiplier: CGFloat = (isHorizontal ? velocity.x : velocity.y) > 0 ? 1 : -1
            proposedContentOffsetCenterOrigin = velocityDirectionMultiplier * 10000
        } else {
            proposedContentOffsetCenterOrigin = (isHorizontal ? proposedContentOffset.x : proposedContentOffset.y) + midSide
        }