engine icon indicating copy to clipboard operation
engine copied to clipboard

Scroll inertia cancel for iPadOS

Open moffatman opened this issue 3 years ago • 3 comments

Send a PointerScrollInertiaCancel event when the user touches the trackpad. Done in two ways, as one only works on real iPad devices, and the other only works when in emulation on an Apple Silicon Mac.

Part of https://github.com/flutter/flutter/issues/106979

Pre-launch Checklist

  • [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities.
  • [x] I read and followed the [Flutter Style Guide] and the [C++, Objective-C, Java style guides].
  • [x] I listed at least one issue that this PR fixes in the description above.
  • [x] I added new tests to check the change I am making or feature I am adding, or Hixie said the PR is test-exempt. See [testing the engine] for instructions on writing and running engine tests.
  • [x] I updated/added relevant documentation (doc comments with ///).
  • [x] I signed the [CLA].
  • [x] All existing and new tests are passing.

moffatman avatar Jul 27 '22 02:07 moffatman

@hellohuanlin would you mind taking a look?

jmagman avatar Jul 27 '22 20:07 jmagman

@moffatman thanks for the contribution, looks like there's still a few minor updates needed (mostly comments and clarifications) to get this through.

jmagman avatar Aug 10 '22 21:08 jmagman

@moffatman thanks for the contribution, looks like there's still a few minor updates needed (mostly comments and clarifications) to get this through.

Yep, will be addressing it soon. I was looking into a way to avoid having to guess with magic numbers at all, but it hasn't panned out.

moffatman avatar Aug 10 '22 21:08 moffatman

@hellohuanlin

image

I updated the numbers after some further data collection. I took the excel line-of-best-fit and subtracted an additional 200ms to account for all outlier data points (we want to bias towards reducing "false positives"/unwanted scroll-cancel events). I think the reason that the numbers are not a direct relationship is because I am using the UIGestureRecognizer velocity, whereas a proper UIScrollView would have a different velocity tracking formula.

This is quite an edge case (flutter-based app running on iPad emulation in a Mac), so this is best-effort basis.

moffatman avatar Aug 23 '22 01:08 moffatman

@moffatman what's the relation between this PR and https://github.com/flutter/flutter/pull/108298? Is this PR ready for another review? And do you need my review on the other PR?

hellohuanlin avatar Aug 23 '22 17:08 hellohuanlin

@hellohuanlin The other PR is kind of related, they both need to estimate the macOS scrolling curve, and improve scroll experience on Mac. But they don't depend on each other in any way. This one is now ready for review, if you want you can look at the other one as well, but not necessary.

moffatman avatar Aug 23 '22 17:08 moffatman

Can we land this please? Looks like all presubs are green.

chinmaygarde avatar Sep 01 '22 20:09 chinmaygarde