Skip to content
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

Fix nested scrolling on mouse wheel #1055

Merged
merged 13 commits into from Feb 14, 2024
Merged

Conversation

MatkovIvan
Copy link
Member

@MatkovIvan MatkovIvan commented Feb 6, 2024

Proposed Changes

  • Use dispatchScroll with a new NestedScrollSource.Wheel instead of direct call of scrollBy/dispatchRawDelta
  • Set scrolling priority to MutatePriority.UserInput during mouse wheel scroll animation
  • Move all scroll delta dispatching into a single coroutine
  • Remove threshold (logic where small delta was applied without animation), shouldApplyImmediately flag based on isPreciseWheelScroll handles it instead.
  • Wait ProgressTimeout after each mouse wheel event before resetting isScrollInProgress flag
  • Enable this logic by default (old "raw" dispatching failed our tests on iOS)

Testing

Test: Check "NestedScroll" page in mpp demo + unit tests

Issues Fixed

Fixes JetBrains/compose-multiplatform#653
Fixes JetBrains/compose-multiplatform#1423

MatkovIvan added a commit that referenced this pull request Feb 12, 2024
## Proposed Changes

- A part from #1055 with cancellation fix

## Testing

Test: run a new unit test
@MatkovIvan MatkovIvan merged commit 3d6ece8 into jb-main Feb 14, 2024
6 checks passed
@MatkovIvan MatkovIvan deleted the ivan.matkov/fix-nested-scroll branch February 14, 2024 13:55
MatkovIvan added a commit that referenced this pull request Feb 14, 2024
## Proposed Changes

- Based on #1055
- Trigger `onScrollStopped` callback after mouse wheel scroll
- Ignore `ScrollableDefaultFlingBehavior`s during mouse scroll to avoid
breaking changes
- Remove scrolling via `dispatchRawDelta`, `isSmoothScrollingEnabled =
false` will just disable animation instead
- Add pager test page in mpp demo

## Testing

Test: run pager page in mpp demo

## Issues Fixed

Fixes JetBrains/compose-multiplatform#3447
Fixes JetBrains/compose-multiplatform#3454
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants