Skip to content

Commit 6c9906a

Browse files
migrantmats-claassen
authored andcommitted
Fix incorrect top inset and content offset (#126)
1 parent 78b96e5 commit 6c9906a

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

Source/ActionController.swift

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -668,20 +668,15 @@ open class ActionController<ActionViewType: UICollectionViewCell, ActionDataType
668668
var bottomInset = settings.cancelView.showCancel ? initialContentInset.bottom + settings.cancelView.height : initialContentInset.bottom
669669
var topInset = height - contentHeight - safeAreaInsets.bottom
670670

671-
if settings.cancelView.showCancel {
672-
topInset -= settings.cancelView.height
673-
}
674-
675-
topInset = max(topInset, 30)
671+
topInset = max(topInset, safeAreaInsets.top + 30)
676672

677673
bottomInset += safeAreaInsets.bottom
678674
leftInset += safeAreaInsets.left
679675
rightInset += safeAreaInsets.right
680-
topInset += safeAreaInsets.top
681676

682677
collectionView.contentInset = UIEdgeInsets(top: topInset, left: leftInset, bottom: bottomInset, right: rightInset)
683678
if !settings.behavior.useDynamics {
684-
collectionView.contentOffset.y = -height + contentHeight + bottomInset
679+
collectionView.contentOffset.y = -topInset
685680
}
686681
}
687682

Source/DynamicCollectionViewFlowLayout.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,6 @@ open class DynamicCollectionViewFlowLayout: UICollectionViewFlowLayout {
176176
}
177177

178178
frame.origin.x = translationX
179-
frame.origin.y -= collectionView.contentInset.bottom
180179
initialFrame.origin.x = translationX
181180

182181
let attributes = UICollectionViewLayoutAttributes(forCellWith: indexPath)

0 commit comments

Comments
 (0)