Skip to content

Commit

Permalink
fix ScrollStrategy consuming horizontal flings
Browse files Browse the repository at this point in the history
  • Loading branch information
sunian committed Nov 23, 2021
1 parent 721400e commit e5ec937
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/src/main/java/me/onebone/toolbar/ScrollStrategy.kt
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ internal class EnterAlwaysNestedScrollConnection(
velocity
}

return available.copy(y = available.y - left)
return Velocity(x = 0f, y = available.y - left)
}
}

Expand Down Expand Up @@ -172,7 +172,7 @@ internal class EnterAlwaysCollapsedNestedScrollConnection(
}

override suspend fun onPreFling(available: Velocity): Velocity =
available.copy(y = tracker.deriveDelta(available.y))
Velocity(x = 0f, y = tracker.deriveDelta(available.y))

override suspend fun onPostFling(consumed: Velocity, available: Velocity): Velocity {
val dy = available.y
Expand All @@ -186,7 +186,7 @@ internal class EnterAlwaysCollapsedNestedScrollConnection(
dy
}

return available.copy(y = available.y - left)
return Velocity(x = 0f, y = available.y - left)
}
}

Expand Down Expand Up @@ -234,7 +234,7 @@ internal class ExitUntilCollapsedNestedScrollConnection(
velocity
}

return available.copy(y = available.y - left)
return Velocity(x = 0f, y = available.y - left)
}

override suspend fun onPostFling(consumed: Velocity, available: Velocity): Velocity {
Expand All @@ -246,6 +246,6 @@ internal class ExitUntilCollapsedNestedScrollConnection(
velocity
}

return available.copy(y = available.y - left)
return Velocity(x = 0f, y = available.y - left)
}
}

0 comments on commit e5ec937

Please sign in to comment.