Skip to content

Commit

Permalink
fix animation glitch when a card swipe is aborted
Browse files Browse the repository at this point in the history
When a user would start swiping a card to the side and then decide to cancel the swipe, the card would stay at a position that was incorrectly alligned.
  • Loading branch information
JoniVR committed Oct 20, 2018
1 parent d8b79ee commit c2a6c45
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Sources/VerticalCardSwiperFlowLayout.swift
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ internal class VerticalCardSwiperFlowLayout: UICollectionViewFlowLayout {
- parameter attributes: The attributes we're updating.
*/
fileprivate func updateCellAttributes(_ attributes: UICollectionViewLayoutAttributes) {

var minY = collectionView!.bounds.minY + collectionView!.contentInset.top
let maxY = attributes.frame.origin.y

Expand All @@ -122,7 +123,7 @@ internal class VerticalCardSwiperFlowLayout: UICollectionViewFlowLayout {
let scale = 1 - deltaY * itemTransform
var t = CGAffineTransform.identity
t = t.scaledBy(x: scale, y: 1)
t = t.translatedBy(x: 0, y: (translationScale + deltaY * translationScale))
t = t.translatedBy(x: 0, y: (deltaY * translationScale))

attributes.transform = t
}
Expand Down

0 comments on commit c2a6c45

Please sign in to comment.