172 Commits

Author SHA1 Message Date
David Reveman
7a6af0cf2c
Reland: Timer based pointer event resampling (#76195)
This reverts #76179 and relands #73042 with an active timer check fix.

Co-authored-by: David Reveman <reveman@google.com>
2021-02-17 13:09:19 -05:00
Jenn Magder
50897c98fc
Revert "Timer based pointer event resampling (#73042)" (#76179)
This reverts commit 9133deb9a714b0853faeed4892b220ae7a77e5a5.
2021-02-16 20:13:53 -08:00
David Reveman
9133deb9a7
Timer based pointer event resampling (#73042)
Timer based pointer event resampling

This provides two improvements to pointer event resampling:

1. PostFrameCallbacks are used instead of scheduling frames. This
avoids unnecessary rendering work when resampling is used.

2. Resampling continues when frames are not produced. I.e. input
events keep being delivered at a fixed frequency even if frame
production is taking a long time.

This fixes #72924

Co-authored-by: David Reveman <reveman@google.com>
Co-authored-by: Tong Mu <dkwingsmt@users.noreply.github.com>
2021-02-16 21:29:59 -05:00
Michael Goderbauer
6afbb25a48
Reject unaccepted pointers in Drag recognizer (#75943) 2021-02-16 10:26:03 -08:00
Sam Rawlins
d0d9b80520
Remove "unnecessary" imports in foundation,gestures tests (#75007) 2021-01-29 14:46:06 -08:00
Alexandre Ardhuin
d546e1d311
fix for upcoming lint use_named_constants (#74788) 2021-01-27 20:20:44 +01:00
xubaolin
4bdea117a4
fix a tap gesture exception (#73846) 2021-01-21 17:29:04 -08:00
xubaolin
32dc1b7d00
Add [pointerCount] property to Scale Gesture Details (#73474) 2021-01-11 19:14:04 -08:00
Tong Mu
e1712ccefc
Reland: Fix a multiple pointers bug
This relands #68587
2020-11-05 18:38:15 -08:00
David Reveman
4aad058a49
Improve resampling of up and remove events. (#69096)
* Improve resampling of up and remove events.

This improves resampling of these events by searching
for them until the next approximate sample time.

Co-authored-by: David Reveman <reveman@google.com>
2020-10-28 17:02:37 -04:00
Jonah Williams
b25ce5b16c
Revert "Fix a multiple pointers bug (#68587)" (#68841)
This reverts commit bde85ea3bb3e80c1294c6d084eb5f9804867be8f.
2020-10-22 19:16:08 -07:00
xubaolin
bde85ea3bb
Fix a multiple pointers bug (#68587)
* Fix mutiple pointers bug

* Add unit test case

* Remove unnecessary map clone
2020-10-22 16:09:47 -07:00
Jonah Williams
c606f044d7
[gestures] make stylus pointer types use touch pan/drag slop (#67885) 2020-10-12 15:20:50 -07:00
Michael Goderbauer
42fa4f033b
Migrate some more non-test utils for tests (#67351) 2020-10-05 18:12:04 -07:00
Darren Austin
01e8c39534
Migrate gestures, physics and scheduler tests to null safety. (#62701) 2020-10-05 16:01:34 -07:00
Tong Mu
2cdf2f0059
Treat hover events as normal pointer events, and bring them back to Listener (#63834) 2020-10-05 12:12:04 -07:00
Michael Goderbauer
687121d6da
Migrate some tests to null-safety (#67085) 2020-10-02 21:52:02 -07:00
Tong Mu
74fe6bff84
Lazily compute PointerEvent's transformed positions (#63813)
* PointerEvent.local* properties are calculated lazily; other properties are delegated to original.
* Transformed PointerEvent becomes a subclass of its original class.
* Unnamed constructors no longer accepts transform and origin.
2020-10-02 15:09:23 -07:00
David Reveman
371667ec94
Fix resampling of down, up, and remove events. (#67080)
This adds the neccessary synthetic move/hover events to
resampler, which is needed for position to not change as
part of a down, up, or remove event.

Co-authored-by: David Reveman <reveman@google.com>
2020-10-02 16:16:57 -04:00
Jonah Williams
b1d17c914d
Deprecate VelocityTracker default constructor and added VelocityTracker.withKind constructor (#66043)
We've gotten feedback that the VelocityTracker change was disruptive, though it did not break any of the flutter framework or customer tests. In order to make the change non-breaking, PointerDeviceKind parameter can be made optional.

Nevertheless, this parameter should be provided so that the existing touch handlers can use more accurate gestures on mouse/stylus inputs, so we can encourage this by deprecating the default constructor and pointing users towards the VelocityTracker.withKind constructor that takes a non-optional parameter
2020-09-17 15:18:31 -07:00
Michael R Fairhurst
7f3c9b6bda
Remove unused 'dart:async' imports. (#65568) 2020-09-16 14:14:06 -07:00
Tong Mu
a48e14308e
Expose GestureBinding.handlePointerEvent, replacing dispatchEvent as the preferred way to dispatch events (#64846) 2020-09-15 22:17:06 -07:00
Jonah Williams
29898812d4
[framework] make hit slop based on device pointer kind for drag/pan/scale gestures (#64267)
Currently the framework uses fairly large "hit slop" values to disambiguate taps from drags/pans. This makes sense on touch devices where the interaction is not very precise, on mice however it can feel as if the UI is lagging. This is immediately noticeable on our infra dashboard, where it takes almost half of a grid square of drag before the actual drag kicks in.

One potential solution is to always use smaller constants depending on whether the interaction is mouse or touch based. The only reasonable choice is to use the pointer device kind and not target platform - same platform can have different input sources. This requires exposing the pointer device kind in a few new places in several of the gesture detectors, and using the enum to compute the correct hit slop from an expanded set of constants.

This almost works, however there are a few places (notably ListViews) which uses the touch hit slop as a default value in scroll physics. It does not seem like it will be easy to disambiguate a user provided scroll physics constant from the default and/or adjust it somehow - this might require significant changes to scroll physics which I have left out of this PR.

This PR does not adjust:

kTouchSlop used in scroll_physics.dart's minFlingDistance
kTouchSlop used in PrimaryPointerGestureRecognizer/LongPressGestureRecognizer
2020-09-08 15:53:36 -07:00
Ming Lyu (CareF)
dcdee4bb0d
Add resampler unit test with widget (#64424) 2020-08-27 16:38:05 -07:00
Todd Volkert
52b5b3ea43
Add GestureDetector.onDoubleTapDown() (#64431)
* Add GestureDetector.onDoubleTapDown()

* Review comments
2020-08-24 13:34:19 -07:00
David Reveman
02612bfe32
Pointer event resampler (#41118) (#60558) 2020-08-24 12:11:05 -07:00
LongCatIsLooong
cea055ef00
Make Scrollable's free scroll initial velocity matches that of iOS (#60501) 2020-08-12 13:31:05 -07:00
creativecreatorormaybenot
96b6aafb49
Add onTertiaryTap* to TapGestureRecognizer and GestureDetector (#62788) 2020-08-08 15:21:02 -07:00
Mouad Debbar
d13b56a0cd
Don't move to word edge when tapping with a mouse (#60177) 2020-08-05 19:16:06 -07:00
Jonah Williams
9be31e26ef
[null-safety] remove quiver from flutter tests (#62866) 2020-08-04 14:26:04 -07:00
Kate Lovett
d1411a1626
Remove unused FlutterErrorDetails subclasses (#61579) 2020-07-24 15:36:08 -07:00
Tong Mu
6f4c4b3cf8
Refactor mouse hit testing system: Direct mouse hit test (#59883) 2020-07-06 17:44:02 -07:00
Alexandre Ardhuin
4d7525f05c
Opt out nnbd in packages/flutter (#59186)
* add language version 2.8 in packages/flutter

* enable non-nullable analyzer flag
2020-06-11 14:11:30 +02:00
Darren Austin
012cee2731
Typo fixing sweep through packages/flutter. (#59219) 2020-06-11 05:10:01 -07:00
Tong Mu
bbc0cc07f6
Move mouse_tracking.dart to rendering (#52781)
* Move mouse_tracking to rendering

* Move test
2020-03-20 11:22:02 -07:00
Tong Mu
b2d53f60e7
Tap gesture no longer add pointer after resetting (#52450)
* TapGestureRecognizer no longer adds the pointer after it resets.

* Adds an assertion to make sure TapGestureRecognizer.startTrackingPointer is never called when _down is null
2020-03-12 18:19:19 -07:00
Tong Mu
da0a7d8b2e
MouseTracker no longer requires annotations attached (#48453) 2020-01-28 15:03:01 -08:00
Alexandre Ardhuin
4f9b6cf017
enable lint prefer_final_in_for_each (#47724) 2020-01-07 16:32:04 +01:00
Mouad Debbar
f6a88d0309
Registering multiple transformed events should work (#48149) 2020-01-06 14:24:52 -08:00
Alexandre Ardhuin
dfbd585668 implicit-casts:false in flutter/test (#46245) 2019-12-16 15:03:02 -08:00
Tong Mu
ad20d368ff Fix null event crash in TapGestureRecognizer (#45943) 2019-12-05 19:33:01 -08:00
Tong Mu
f8027a795d Only schedule callback when there is mouse (#46113) 2019-12-05 12:18:03 -08:00
Tong Mu
afb8f38211
Improve MouseTracker lifecycle: Move checks to post-frame (#44631)
This PR rewrites MouseTracker's lifecycle, so that mouse callbacks are all triggered in post frame, instead of the current one where some are triggered during the build phase. This PR also changes the onExit callback to MouseRegion, RenderMouseRegion, and MouseTrackerAnnotation, so that it is no longer triggered on dispose.
2019-12-02 13:00:48 -08:00
Ian Hickson
449f4a6673
License update (#45373)
* Update project.pbxproj files to say Flutter rather than Chromium

Also, the templates now have an empty organization so that we don't cause people to give their apps a Flutter copyright.

* Update the copyright notice checker to require a standard notice on all files

* Update copyrights on Dart files. (This was a mechanical commit.)

* Fix weird license headers on Dart files that deviate from our conventions; relicense Shrine.

Some were already marked "The Flutter Authors", not clear why. Their
dates have been normalized. Some were missing the blank line after the
license. Some were randomly different in trivial ways for no apparent
reason (e.g. missing the trailing period).

* Clean up the copyrights in non-Dart files. (Manual edits.)

Also, make sure templates don't have copyrights.

* Fix some more ORGANIZATIONNAMEs
2019-11-27 15:04:02 -08:00
chunhtai
314eb3bae3
Moving pointer event sanitizing to engine. (#44217) 2019-11-20 13:04:29 -08:00
Taufiq Rahman
3243ebe3ee Tap.dart: Fixes the spacing to the right side of reason (#43246) 2019-11-06 14:48:43 -08:00
Pieter van Loon
0120c414fb Improved ios 13 scrollbar fidelity (#41799)
Drag from the right is no more
Longpress is now only 100ms instead of 500
Added optional duration field to longpressgesturerecognizer
Added controller field to material scrollbar api
Haptic feedback only triggers when scrollbar is fully expanded
Added haptic feedback when releasing the scrollbar after dragging it
2019-10-29 08:46:21 -07:00
Tong Mu
0aafdfa55a
Redo: Rewrite MouseTracker's tracking and notifying algorithm (#42486)
* Revert "Revert "Rewrite MouseTracker's tracking and notifying algorithm (#42031)" (#42478)"

This reverts commit eede792923ece2d76106c9e0742c45000be48834.

* Fix tests
2019-10-11 10:10:56 -07:00
Jonah Williams
eede792923
Revert "Rewrite MouseTracker's tracking and notifying algorithm (#42031)" (#42478) 2019-10-10 16:44:10 -07:00
Tong Mu
53636374dc
Rewrite MouseTracker's tracking and notifying algorithm (#42031)
* Redesigns the algorithm with which MouseTracker keeps track of states and dispatches events.
2019-10-10 16:28:56 -07:00