Fall back to linear initial velocity if there's not enough samples for inertia #14961
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does the pull request do?
Fallbacks to linear scroll velocity if not enough touchpoints have been registered in a swipe for polynomial computation of inertia.
This also adds a touch point at pointer press to the velocity tracker to ensure start and end points of the swipe are accounted for in the tracker.
What is the current behavior?
Some mobile os and devices have reduced touch polling rate when no activity is detected on screen, or as a power saving measure. Because of this, a flick on the screen could be faster than the os can send event that, our tracker would only register 1 or 2 pointer move events. With so few points being register in that gesture, the tracker returns 0 for inertia, even though the user has completed a swipe.
What is the updated/expected behavior with this PR?
A quick flick on a touch screen will be detected as a scroll swipe.
How was the solution implemented (if it's not obvious)?
Since we are guaranteed a PointerPressed if a user touches the screen, we register that point as the first point(0,0) in the tracker. If a swipe is done, this will add another point to the tracker on PointerMoved. If no more pointer move event are sent, we have at least 2 points to calculate the velocity of the fling when the pointer is released.
Checklist
Breaking changes
Obsoletions / Deprecations
Fixed issues
Fixes #14919