Skip to content

Commit 997713e

Browse files
committed
Merge pull request lxcid#48 from raphaelschaad/master
Fix "cell is slipping away under finger"-bug
2 parents f3033c1 + dd109b6 commit 997713e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

LXReorderableCollectionViewFlowLayout/LXReorderableCollectionViewFlowLayout.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,9 @@ - (void)handleScroll:(CADisplayLink *)displayLink {
213213
CGSize frameSize = self.collectionView.bounds.size;
214214
CGSize contentSize = self.collectionView.contentSize;
215215
CGPoint contentOffset = self.collectionView.contentOffset;
216-
CGFloat distance = self.scrollingSpeed / LX_FRAMES_PER_SECOND;
216+
// Important to have an integer `distance` as the `contentOffset` property automatically gets rounded
217+
// and it would diverge from the view's center resulting in a "cell is slipping away under finger"-bug.
218+
CGFloat distance = rint(self.scrollingSpeed / LX_FRAMES_PER_SECOND);
217219
CGPoint translation = CGPointZero;
218220

219221
switch(direction) {

0 commit comments

Comments
 (0)