Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

[platform_views] Fix duplicated touch event pass down to flutter view from platform view. #8026

Merged
merged 4 commits into from
Mar 4, 2019

Conversation

cyanglaz
Copy link
Contributor

@cyanglaz cyanglaz commented Mar 4, 2019

Fix for flutter/flutter#27700 and flutter/flutter#24207

There are 2 fixes included in this PR.

  1. The intercepting views sometime pass up the touches events to flutter view, even after the forward gesture recognizer pass the event to the flutter view. We only want the event to be passed to the flutter view once. So we let the intercepting view 'consumes' the event in this PR to fix the problem.

  2. When a touch sequence has multiple touch points participated(e.g. Pinch gesture), the touchesBegan and touchesEnded can be triggered multiple times if the touches do not happen simultaneously. One example would be: when performing a pinch gesture with 2 fingers, I put down one finger, keep the finger on the screen, then put down another finger, perform pinch, lift up both finger at the same time. In this sequence, touchesBegan is called twice with each touch in one of the calls and touchesEnded is called once and has 2 touches in the callback. To handle this issue, we added a count to count the touches in one touch sequence. We only set the state to fail when the count reaches 0(That is all the touches has began in the current sequence is ended).

@cyanglaz cyanglaz requested a review from amirh March 4, 2019 21:14
Copy link
Contributor

@amirh amirh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM modulo nit

@@ -395,19 +410,24 @@ @implementation ForwardingGestureRecognizer {
// So this is safe as when FlutterView is deallocated the reference to ForwardingGestureRecognizer
// will go away.
UIView* _flutterView;
// Counting the touches that has started in one touch sequence.
NSInteger _currentEventTouchCount;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: maybe call it pointersCount? (I believe this is counting the number of pointers that are currently touching the screen?)

@cyanglaz cyanglaz merged commit 36ca574 into flutter:master Mar 4, 2019
@cyanglaz cyanglaz deleted the gesture_fix branch March 4, 2019 23:55
cbracken added a commit to cbracken/flutter that referenced this pull request Mar 5, 2019
flutter/engine@f4951df19 (upstream/master) Minor cleanups to CONTRIBUTING.md (flutter/engine#8043)
flutter/engine@effee2f80 remove extra statement (flutter/engine#8041)
flutter/engine@14e082fa0 (master) add lint script for Android with baseline (flutter/engine#8036)
flutter/engine@5fed42197 Roll src/third_party/skia 25bc174cf682..72542816cadb (14 commits) (flutter/engine#8040)
flutter/engine@e6a5201f0 Add missing values to semantics action enums (flutter/engine#8033)
flutter/engine@75d4db31d Roll src/third_party/skia fbc887df72ec..25bc174cf682 (7 commits) (flutter/engine#8039)
flutter/engine@c46226980 Roll src/third_party/skia 0a57971f0544..fbc887df72ec (1 commits) (flutter/engine#8037)
flutter/engine@ed628da00 Add missing kHasImplicitScrolling enum value (flutter/engine#8030)
flutter/engine@052774e1c Roll src/third_party/skia e3e80b7edfd1..0a57971f0544 (16 commits) (flutter/engine#8035)
flutter/engine@2cd9b41ba Select MPL instead of LGPL (flutter/engine#7991)
flutter/engine@629c0d836 Roll src/third_party/dart 7d8ffe0daf..571ea80e11 (3 commits)
flutter/engine@8f1fdcd19 Android Embedding PR 14: Almost done with FlutterFragment. (flutter/engine#8000)
flutter/engine@fb3e35d6a Android Embedding PR15: Add Viewport Metrics to FlutterView (flutter/engine#8029)
flutter/engine@36ca5740c (flutter/engine#8026)
flutter/engine@3d53e2026 Roll src/third_party/skia 5800f2e8a920..e3e80b7edfd1 (2 commits) (flutter/engine#8028)
flutter/engine@f3d4a7f71 Roll src/third_party/dart 7c70ab1817..7d8ffe0daf (77 commits)
flutter/engine@a2246c199 Start of linting Android embedding (flutter/engine#8023)
flutter/engine@48bf4803e [fuchsia] Fix snapshot BUILD.gn file for Fuchsia roll (flutter/engine#8024)
cbracken added a commit to flutter/flutter that referenced this pull request Mar 6, 2019
flutter/engine@f4951df19 (upstream/master) Minor cleanups to CONTRIBUTING.md (flutter/engine#8043)
flutter/engine@effee2f80 remove extra statement (flutter/engine#8041)
flutter/engine@14e082fa0 (master) add lint script for Android with baseline (flutter/engine#8036)
flutter/engine@5fed42197 Roll src/third_party/skia 25bc174cf682..72542816cadb (14 commits) (flutter/engine#8040)
flutter/engine@e6a5201f0 Add missing values to semantics action enums (flutter/engine#8033)
flutter/engine@75d4db31d Roll src/third_party/skia fbc887df72ec..25bc174cf682 (7 commits) (flutter/engine#8039)
flutter/engine@c46226980 Roll src/third_party/skia 0a57971f0544..fbc887df72ec (1 commits) (flutter/engine#8037)
flutter/engine@ed628da00 Add missing kHasImplicitScrolling enum value (flutter/engine#8030)
flutter/engine@052774e1c Roll src/third_party/skia e3e80b7edfd1..0a57971f0544 (16 commits) (flutter/engine#8035)
flutter/engine@2cd9b41ba Select MPL instead of LGPL (flutter/engine#7991)
flutter/engine@629c0d836 Roll src/third_party/dart 7d8ffe0daf..571ea80e11 (3 commits)
flutter/engine@8f1fdcd19 Android Embedding PR 14: Almost done with FlutterFragment. (flutter/engine#8000)
flutter/engine@fb3e35d6a Android Embedding PR15: Add Viewport Metrics to FlutterView (flutter/engine#8029)
flutter/engine@36ca5740c (flutter/engine#8026)
flutter/engine@3d53e2026 Roll src/third_party/skia 5800f2e8a920..e3e80b7edfd1 (2 commits) (flutter/engine#8028)
flutter/engine@f3d4a7f71 Roll src/third_party/dart 7c70ab1817..7d8ffe0daf (77 commits)
flutter/engine@a2246c199 Start of linting Android embedding (flutter/engine#8023)
flutter/engine@48bf4803e [fuchsia] Fix snapshot BUILD.gn file for Fuchsia roll (flutter/engine#8024)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants