-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Animate scroll initiated by mouse wheel input #438
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Looks good with mouse and touch.
...undation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/Scrollable.kt
Outdated
Show resolved
Hide resolved
...undation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/Scrollable.kt
Outdated
Show resolved
Hide resolved
...undation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/Scrollable.kt
Outdated
Show resolved
Hide resolved
...undation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/Scrollable.kt
Outdated
Show resolved
Hide resolved
...undation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/Scrollable.kt
Show resolved
Hide resolved
...undation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/Scrollable.kt
Outdated
Show resolved
Hide resolved
...undation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/Scrollable.kt
Outdated
Show resolved
Hide resolved
...undation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/Scrollable.kt
Show resolved
Hide resolved
...undation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/Scrollable.kt
Outdated
Show resolved
Hide resolved
...undation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/Scrollable.kt
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks very smooth on the latest commit on Windows with a mouse, and works as expected on macOs with a touchpad/mouse (without smoothing)
...undation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/Scrollable.kt
Show resolved
Hide resolved
...undation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/Scrollable.kt
Show resolved
Hide resolved
...undation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/Scrollable.kt
Show resolved
Hide resolved
...undation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/Scrollable.kt
Outdated
Show resolved
Hide resolved
...undation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/Scrollable.kt
Show resolved
Hide resolved
...undation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/Scrollable.kt
Show resolved
Hide resolved
...ndation/src/desktopTest/kotlin/androidx/compose/foundation/gestures/DesktopScrollableTest.kt
Outdated
Show resolved
Hide resolved
...undation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/Scrollable.kt
Outdated
Show resolved
Hide resolved
…l input (#438) * Set scroll progress state on mouse events * Animate mouse wheel scroll * Refactor changes * Add helper inline functions * Batch offsets * Filter zero values and apply raw delta only without animation * Use scrollBy inside animation, fix parameter usage in lambda * Fix tests * Add TODOs and comments * Fix more tests * Cleanup mouse hover test helper class * Add test for scroll during animation * Address feedback (part 1) * Make smooth scrolling configurable * Do not animate scroll on events from trackpads * Fix internal type for tests * Make animation scrolling speed density dependant * Fix conditionally applying scroll modifier * Fix cancel animation condition * Cache smooth scrolling flag * Adjust scrolling animation threshold * Add isScrollInProgress TODO * Add test for isSmoothScrollingEnabled flag * Reset flag in finally * Use strict comparison to detect consuming event
Proposed Changes
isScrollInProgress
: It's true during animation now ( LazyListState.isScrollInProgress is always false on desktop compose-multiplatform#1423 )Testing
Test: Scroll some scrollable view via mouse wheel; Observe smooth animated position changes.
Issues Fixed
Fixes JetBrains/compose-multiplatform#1955