Skip to content

Commit 19049d4

Browse files
committed
Add threshold when settings content offset
1 parent d36020d commit 19049d4

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

DMScrollBar/DMScrollBar.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,7 @@ public class DMScrollBar: UIView {
375375
animations: { [weak self] _, time in
376376
guard let self else { return }
377377
let newY = self.scrollOffsetFromScrollIndicatorOffset(parameters.value(at: time).y)
378+
if abs(scrollView.contentOffset.y - newY) < parameters.threshold { return }
378379
scrollView.setContentOffset(CGPoint(x: 0, y: newY), animated: false)
379380
}, completion: { [weak self] finished in
380381
guard let self else { return }

0 commit comments

Comments
 (0)