Conversation
...i/ui/src/skikoMain/kotlin/androidx/compose/ui/input/pointer/util/PointerVelocityTracker1D.kt
Outdated
Show resolved
Hide resolved
...i/ui/src/skikoMain/kotlin/androidx/compose/ui/input/pointer/util/PointerVelocityTracker1D.kt
Outdated
Show resolved
Hide resolved
...i/ui/src/skikoMain/kotlin/androidx/compose/ui/input/pointer/util/PointerVelocityTracker1D.kt
Show resolved
Hide resolved
Removed unnecessary adjustment logic for sample count.
| if (dataPoints[sampleCount - 1] < dataPoints[0] && velocity < 0) { | ||
| return 0f | ||
| } | ||
| if (dataPoints[sampleCount - 1] > dataPoints[0] && velocity > 0) { | ||
| return 0f | ||
| } |
There was a problem hiding this comment.
I think this is a wrong logic: it is a normal situation when user does two-directional gesture by their intent. We need to detect only one point mistakes (as you showed).
There was a problem hiding this comment.
To be honest, I still think we don't need to do that at all
There was a problem hiding this comment.
The investigation showed that fixing the "one point mistake" cannot fix the expected behavior of the gesture. There are several reasons: It can be more then one point the goes on the opposite direction from the gesture direction and on 120 fps the density of events is higher (or very low in case of lags) - this approach cannot be applied in such cases.
The goal of this MR to align behavior between native iOS and Compose scrolls. Tests show that current logic helps more closely mimic the iOS scrolling experience. We can either make this behavior multiplatform or move it to the iOS codebase.
My vote here for Multiplatform solution: scroll behavior for browsers on iOS also need to be aligned with iOS experience.
There was a problem hiding this comment.
Could you implement a pure swift app with a scroll view + touch points tracking and show how it works on iOS?
Move
WebVelocityTracker1Dto the skiko source set and rename it to thePointerVelocityTracker1D.Add
preventReversedPointerMovementsoption that prevents velocity tracker from returning velocity with the opposite direction to the general scroll direction.Fixes https://youtrack.jetbrains.com/issue/CMP-9297/Fling-gestures-not-working-correctly-in-LazyColumn-on-iOS.
Release Notes
Fixes - iOS