Skip to content

Commit

Permalink
ASBatchFetching to not round scroll velocity (#294)
Browse files Browse the repository at this point in the history
- Doing so causes remaining time to be slightly inaccurate.
  • Loading branch information
nguyenhuy committed May 19, 2017
1 parent 6aa5ad7 commit 6db8cc1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Source/Private/ASBatchFetching.m
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,10 @@ BOOL ASDisplayShouldFetchBatchForContext(ASBatchContext *context,
CGFloat triggerDistance = viewLength * leadingScreens;
CGFloat remainingDistance = contentLength - viewLength - offset;
BOOL result = remainingDistance <= triggerDistance;

if (delegate != nil && (velocityLength = round(fabs(velocityLength))) > 0) {

if (delegate != nil && velocityLength > 0.0) {
// Don't need to get absolute value of remaining time
// because both remainingDistance and velocityLength are positive when scrolling toward tail
NSTimeInterval remainingTime = remainingDistance / (velocityLength * 1000);
result = [delegate shouldFetchBatchWithRemainingTime:remainingTime hint:result];
}
Expand Down

0 comments on commit 6db8cc1

Please sign in to comment.