-
Notifications
You must be signed in to change notification settings - Fork 6k
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
i82973 scroll mouse wheel support #44724
i82973 scroll mouse wheel support #44724
Conversation
…e that then scrolls than android
shell/platform/android/io/flutter/embedding/android/AndroidTouchProcessor.java
Outdated
Show resolved
Hide resolved
shell/platform/android/io/flutter/embedding/android/AndroidTouchProcessor.java
Outdated
Show resolved
Hide resolved
shell/platform/android/io/flutter/embedding/android/AndroidTouchProcessor.java
Outdated
Show resolved
Hide resolved
shell/platform/android/io/flutter/embedding/android/AndroidTouchProcessor.java
Outdated
Show resolved
Hide resolved
@LoveJello When merging in #43949 my code causes your tests to fail. Any ideas what broke? One of the changes I made was to the mock where I made isFromSource more closely match the actual implementation, |
Sorry for late response.I added some comment in the code. |
@@ -192,7 +195,9 @@ public boolean onGenericMotionEvent(@NonNull MotionEvent event) { | |||
boolean isMovementEvent = | |||
(event.getActionMasked() == MotionEvent.ACTION_HOVER_MOVE | |||
|| event.getActionMasked() == MotionEvent.ACTION_SCROLL); |
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.
The change below was made for readability since @camsim99 and I both thought the implementation was confusing. It should be functionally identical and easier to follow. If a reviewer disagree please comment here and let me know.
John offered to test horizontal scroll with a mouse with a second scroll wheel after this lands. |
This pull request has been changed to a draft. The currently pending flutter-gold status will not be able to resolve until a new commit is pushed or the change is marked ready for review again. |
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.
@@ -8,11 +8,16 @@ | |||
import static org.mockito.Mockito.when; |
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.
These tests! 🤌 Thanks for shaving this down and adding all this coverage.
shell/platform/android/io/flutter/embedding/android/AndroidTouchProcessor.java
Outdated
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 good, thanks 😄
Pre api 26, horizontal scroll wheel testing will happen post merge given my difficulty finding hardware and not being able to test against an emulator. |
…133075) flutter/engine@21437d3...28b8bd5 2023-08-22 reidbaker@google.com i82973 scroll mouse wheel support (flutter/engine#44724) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC jimgraham@google.com,rmistry@google.com,zra@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Fixes flutter/flutter#82973 Mouse scroll wheel support for android. I chose to not cache the vertical and horizontal scale factors that come from view configuration. The primary reason is that in the current code path context is only used when the user scrolls which was the unimplemented feature. This smaller blast radius I decided was worth the additional calls. A secondary reason is that when the scale factors are changed is not a well documented path nor is there a lifecycle callback to listen to. Scroll factor is cached on api 25 and below because that more closely mirrors the behavior I see in pre 25 versions of android scroll view. Note flutter takes longer to "see" a mouse that then scrolls than android Fixes #flutter/flutter/82973 Todo list prior to merge ## Links * Some pre api 26 scroll factor code - https://cs.android.com/android/platform/superproject/main/+/main:frameworks/base/core/java/android/view/View.java?q=function:getVerticalScrollFactor%20filepath:android%2Fview%2FView.java&ss=android%2Fplatform%2Fsuperproject%2Fmain - https://cs.android.com/android/_/android/platform/frameworks/base/+/main:core/java/android/widget/ScrollView.java;l=930;drc=2fe301db7555bccf53e465436d4cb7442c803df3;bpv=0;bpt=0 * Post api 26 scroll factor code - https://cs.android.com/android/_/android/platform/frameworks/base/+/main:core/java/android/widget/ScrollView.java;l=361;drc=406e0f655387f27dda874c2b975fb0ddbd61aa13;bpv=0;bpt=0 - https://developer.android.com/reference/android/view/ViewConfiguration#getScaledVerticalScrollFactor()
Fixes flutter/flutter#82973
Mouse scroll wheel support for android.
I chose to not cache the vertical and horizontal scale factors that come from view configuration. The primary reason is that in the current code path context is only used when the user scrolls which was the unimplemented feature. This smaller blast radius I decided was worth the additional calls. A secondary reason is that when the scale factors are changed is not a well documented path nor is there a lifecycle callback to listen to. Scroll factor is cached on api 25 and below because that more closely mirrors the behavior I see in pre 25 versions of android scroll view.
Note flutter takes longer to "see" a mouse that then scrolls than android
Fixes #flutter/flutter/82973
Todo list prior to merge
Links
Pre-launch Checklist
///
).