138 Commits

Author SHA1 Message Date
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
Tong Mu
94515ba590
Make MouseTracker.sendMouseNotifications private (#41879)
* Make sendMouseNotifications private
2019-10-09 18:29:02 -07:00
Yegor
ebfe6020b8
Enable more web tests; use blacklist to filter them out (#41922)
Add more web tests;use blacklist instead of whitelist
2019-10-07 15:05:24 -07:00
Tong Mu
297fe91f51
Refactor: Make MouseTracker test concise with some utility functions (#41791)
* Extract pointerData and _equalToEventsOnCriticalFields for simplicity
2019-10-03 16:33:31 -07:00
Tong Mu
0b0942a60c
Refactor: Base tap gesture recognizer (#41329)
* Extracts the logic of TapGestureRecognizer into an abstract class BaseTapGestureRecognizer
* Fixes ModalBarrier unable to dismiss when competing
2019-10-02 15:28:55 -07:00
Alexandre Ardhuin
f0553ba58e
Missing trailing commas (#41473)
* add missing trailing commas

* add more missing trailing commas

* add more and more missing trailing commas
2019-09-30 18:48:23 +02:00
Kristin Ho
034358e341 Prevent PointerEnter[or Exit]Event from erasing event.down value (#40637) (#41332)
* MouseRegion documentation claimed that onEnter and onExit
  would track entry and exit regardless of whether the pointer was
  down or up
* It did such, but when grabbing the value of `event.down` from
  the passed event, the value was always `false`
* PointerEnterEvent and PointerExitEvent were overriding the value
  passed from PointerEvent in constructors, even if the value was true
  e.g. in invocations of .fromMouseEvent((PointerMoveEvent...))
* This change now passes the value along to PointerEnter/ExitEvents
  while providing it a default of false, and updates documentation

Fixes #40637
2019-09-26 13:48:40 -07:00
Greg Spencer
0509791663
Fix mouse hover to not schedule a frame for every mouse move. (#41014)
This fixes the mouse hover code to not schedule frames with every mouse move.

Before this, it would schedule a post frame callback, and then schedule a frame immediately, even if there was nothing that needed to be updated. Now it will schedule checks for mouse position updates synchronously, unless there's a new annotation, and skip scheduling a new frame in all cases. It has to be async in the case of a new annotation (i.e. a new MouseRegion is added), since when the annotation is added, it hasn't yet painted, and it can't hit test against the new layer until after the paint, so in that case it schedules a post frame callback, but since it's already building a frame when it does that, it doesn't need to schedule a frame.

The code also used to do mouse position checks for all mice if only one mouse changed position. I fixed this part too, so that it will only check position for the mouse that changed.
2019-09-26 13:13:42 -07:00
Alexandre Ardhuin
b873162194
fix some bad indentations (#41172) 2019-09-24 21:03:37 +02:00
Alexandre Ardhuin
e9965f5636
add missing trailing commas in packages/flutter (#41076) 2019-09-24 08:05:41 +02:00
Tong Mu
7f02566ca6
Add "OneSequenceRecognizer.resolvePointer". Fix DragGestureRecognizer crash on multiple pointers (#39017)
* Add drag tests

* Add resolvePointer

* Correct monodrag implementation

* Fix some addTearDown
2019-08-26 17:44:01 -07:00
Michael Goderbauer
926bc6231a
Remove print (#34004) 2019-06-06 16:26:12 -07:00
Michael Goderbauer
9114f4456c
Add localFocalPoint to ScaleDetector (#33955) 2019-06-06 11:09:39 -07:00
Tong Mu
c482edac4f
Revert "Move declaration of semantic handlers from detectors to recognizers (#33475)" (#33851)
This reverts commit 572f349f5c7db7a783870ea8d4ecc641a365563f.
2019-06-04 10:13:15 -07:00
Tong Mu
572f349f5c
Move declaration of semantic handlers from detectors to recognizers (#33475)
- A refactor that moves the semantics declaration from detectors to recognizers to allow custom recognizers to respond to semantic gectures.
- Renames all handlers related to semantics from Gesture* to Semantics*.
2019-06-03 15:07:23 -07:00
Michael Goderbauer
ae23d4a490
Transform PointerEvents to the local coordinate system of the event receiver (#32192) 2019-05-31 16:48:50 -07:00
Greg Spencer
07aede4c31
Fix onExit calling when the mouse is removed. (#33477)
This PR solves two problems: currently, the onExit is called for a mouse pointer the moment the removal message is received, except that by the time it actually calls it, there is no _lastEvent for it in the mouse tracker (it's already been removed), resulting in an event being passed to the onExit that contains nulls for the position. Also, removePointer events don't actually get created with a position, although they easily could be, so that even the the _lastEvent in the mouse tracker were still populated, it would still give a null position and delta.

This PR adds support for the position and delta in a PointerRemovedEvent, and populates them. In addition, when a remove event is received, it doesn't actually remove the pointer until the mouse position check that gets scheduled actually happens.
2019-05-30 09:55:38 -07:00
Chris Bracken
156b4220b4
Americanise spellings (#33323)
Updates documentation and non-public API to use American spellings for
consistency with the rest of the codebase.

No changes to behaviour... other than how it's spelt.
2019-05-24 19:13:02 -07:00
Chris Bracken
4d9923201b
Correct typos (#33322)
Corects a bnuch of typeos throuhgout teh Fluter codebsae.

Made use of the `misspell` tool:
https://github.com/client9/misspell
2019-05-24 19:12:45 -07:00
Tong Mu
7f969d0f8a
Redo#2: Add buttons to gestures (#31935)
* Revert "Revert "Redo: Add buttons to gestures (#31819)" (#31912)"

This reverts commit 60a1b2b9ea761b4785a7c416417e64da4501ec0e.
2019-05-20 14:18:30 -07:00
Mouad Debbar
bcae3563d4
Redo: Show/hide toolbar and handles based on device kind (#32704) 2019-05-14 11:04:16 -07:00
Mouad Debbar
ef5abcc6bf
Revert "Show/hide toolbar and handles based on device kind (#29683)" (#32702)
This reverts commit 18ca37542d8e946724f1ccc41b6d7c98c28d7164.
2019-05-14 09:33:04 -07:00
Mouad Debbar
18ca37542d
Show/hide toolbar and handles based on device kind (#29683) 2019-05-14 08:50:23 -07:00
Michael Goderbauer
1621baafc7
Introduce separate HitTestResults for Box and Sliver (#31894) 2019-05-09 10:00:01 +02:00
Greg Spencer
aeccd6a8bc
Fix nested listeners so that ancestor listeners can also receive enter/exit/move events. (#32350)
This changes Listener to trigger enter/move/exit in all Listeners below the pointer, not just the leaf region (the first region hit). This is because we need to allow listeners to be nested so that, say, a widget that handles changing color on hover, but also is wrapped in a Tooltip (that handles hover) can trigger both actions, not just one.

To that end, I added a findAll to Layer, similar to the existing find method that was previously used. It returns an iterator over annotated layers which match the given data type.

Since the findAll is implemented as returning an Iterable (and is sync*), I re-implemented the find routines as just returning the first result from findAll, since that should be just as efficient, and would then prevent duplication in the implementation.
2019-05-08 17:57:42 -07:00
Tong Mu
7beb09e76a
Redo "Remove pressure customization from some pointer events" (#30874)
* Revert "Revert "Remove pressure customization from some pointer events (#30414)" (#30873)"

This reverts commit f34c2ef0a31b7d955035576eeedb0cee7508b2a8.

* Revert pressure removal of PointerUpEvent

* Replace PR with an issue

* Add tests for fromMouseEvent
2019-05-02 23:05:01 -07:00
Jonah Williams
60a1b2b9ea
Revert "Redo: Add buttons to gestures (#31819)" (#31912)
This reverts commit fea2c7d671633fea21bfc93ccddbb57c4510752f.
2019-05-01 10:06:45 -07:00
Tong Mu
fea2c7d671
Redo: Add buttons to gestures (#31819)
* Revert "Revert "Add buttons to gestures (#30339)" (#31801)"

This reverts commit 8fd7fa492aaad0d0d4aa062d71b1ecba8b0d4f44.

* Synthesise kPrimaryButton for unknown devices

* Change TestPointer to a better API
2019-04-30 09:56:24 -07:00
Jonah Williams
8fd7fa492a
Revert "Add buttons to gestures (#30339)" (#31801)
This reverts commit 727e7e829f4debf7a7aaaad3c37151b362ed4cba.
2019-04-29 12:59:30 -07:00
Tong Mu
727e7e829f
Add buttons to gestures (#30339)
* Callbacks of tap, long press, drag, and double tap GR respond to only primary events.
* Add "secondary" callbacks to tap.
* Recognizers only compete on events if there are any related callbacks.
* Add "kSecondaryButton" constant.
2019-04-29 10:46:33 -07:00
Tong Mu
0fb6a05054
PointerDownEvent and PointerMoveEvent default buttons to 1 (#30579)
* Down and Move have default buttons = kPrimary.
2019-04-22 10:15:26 -07:00
Emily Fortuna
ce6fbcea20
Allow mouse hover to only respond to some mouse events but not all. (#30886)
* Allow mouse hover to only respond to some mouse events but not all.
2019-04-11 16:29:21 -07:00
Tong Mu
1ae32facfe
Correctly synthesise event buttons (#30535)
* Correctly synthesise buttons, and add tests
2019-04-05 09:53:40 -07:00
Tong Mu
13101c1a86
Touching the screen adds 0x01 to buttons (#30457)
* Add constants `kPrimaryButton`, `kTouchContact` and `kStylusContact`
* PointerDownEvent and PointerMoveEvent will always set the 0x01 bit on buttons
2019-04-04 15:11:29 -07:00
Tong Mu
423cf223d9
Fix edge cases of PointerEventConverter (#29998)
* Fix: ui.PointerChange.remove might contain position change, but we used to expand it into a Cancel and Remove, neither of which allows position change. A Hover event is added, and a test is updated accordingly.
* Fixed the issue where a PointerMoveEvent and a PointerCancelEvent do not receive the correct pressure.
* Refactor the calculation of delta into deltaTo.
2019-04-04 10:27:07 -07:00