Skip to content

Commit

Permalink
Add threshold when settings content offset
Browse files Browse the repository at this point in the history
  • Loading branch information
batanus committed Nov 17, 2023
1 parent d36020d commit 19049d4
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions DMScrollBar/DMScrollBar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,7 @@ public class DMScrollBar: UIView {
animations: { [weak self] _, time in
guard let self else { return }
let newY = self.scrollOffsetFromScrollIndicatorOffset(parameters.value(at: time).y)
if abs(scrollView.contentOffset.y - newY) < parameters.threshold { return }
scrollView.setContentOffset(CGPoint(x: 0, y: newY), animated: false)
}, completion: { [weak self] finished in
guard let self else { return }
Expand Down

0 comments on commit 19049d4

Please sign in to comment.