Skip to content

Commit

Permalink
ScrollComponent: Fix range being used when it is empty
Browse files Browse the repository at this point in the history
Linear: EM-2063
GitHub: #128
  • Loading branch information
Sychic authored Oct 27, 2023
1 parent 282de68 commit f4bdee3
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ class ScrollComponent constructor(
var changed = false
val offset = if (isHorizontal) ::horizontalOffset else ::verticalOffset
val range = calculateOffsetRange(isHorizontal)
val newOffset = (if(range.isEmpty()) innerPadding else offset.get() + delta * pixelsPerScroll * currentScrollAcceleration).coerceIn(range)
val newOffset = if(range.isEmpty()) innerPadding else (offset.get() + delta * pixelsPerScroll * currentScrollAcceleration).coerceIn(range)
if (newOffset != offset.get()) {
changed = true
offset.set(newOffset)
Expand Down

0 comments on commit f4bdee3

Please sign in to comment.