Skip to content

Commit 1d91462

Browse files
committed
Uses - [CADisplayLink duration] to calculate the distance to scroll.
1 parent 3c955a7 commit 1d91462

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

LXReorderableCollectionViewFlowLayout/LXReorderableCollectionViewFlowLayout.m

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
#import <QuartzCore/QuartzCore.h>
1010
#import <objc/runtime.h>
1111

12-
#define LX_FRAMES_PER_SECOND 60.0
13-
1412
#ifndef CGGEOMETRY_LXSUPPORT_H_
1513
CG_INLINE CGPoint
1614
LXS_CGPointAdd(CGPoint point1, CGPoint point2) {
@@ -220,7 +218,7 @@ - (void)handleScroll:(CADisplayLink *)displayLink {
220218
UIEdgeInsets contentInset = self.collectionView.contentInset;
221219
// Important to have an integer `distance` as the `contentOffset` property automatically gets rounded
222220
// and it would diverge from the view's center resulting in a "cell is slipping away under finger"-bug.
223-
CGFloat distance = rint(self.scrollingSpeed / LX_FRAMES_PER_SECOND);
221+
CGFloat distance = rint(self.scrollingSpeed * displayLink.duration);
224222
CGPoint translation = CGPointZero;
225223

226224
switch(direction) {

0 commit comments

Comments
 (0)