mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
fix: Emit scrolled event from onPreScroll
This commit is contained in:
parent
3399d6a326
commit
8a28d1d484
1 changed files with 2 additions and 6 deletions
|
@ -166,12 +166,8 @@ private fun Modifier.drawScrollbar(
|
|||
}
|
||||
val nestedScrollConnection = remember(orientation, scrolled) {
|
||||
object : NestedScrollConnection {
|
||||
override fun onPostScroll(
|
||||
consumed: Offset,
|
||||
available: Offset,
|
||||
source: NestedScrollSource,
|
||||
): Offset {
|
||||
val delta = if (orientation == Orientation.Horizontal) consumed.x else consumed.y
|
||||
override fun onPreScroll(available: Offset, source: NestedScrollSource): Offset {
|
||||
val delta = if (orientation == Orientation.Horizontal) available.x else available.y
|
||||
if (delta != 0f) scrolled.tryEmit(Unit)
|
||||
return Offset.Zero
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue