Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(804)

Unified Diff: ui/events/gesture_detection/gesture_provider.cc

Issue 243403002: Add multi-finger swipe detection to GestureDetector (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix M_PI Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/events/gesture_detection/gesture_provider.cc
diff --git a/ui/events/gesture_detection/gesture_provider.cc b/ui/events/gesture_detection/gesture_provider.cc
index 84fb854aec78d5669059458c118a6033579ba76b..21a6b1e173b51b1d71b77089f8a12b42c0754b99 100644
--- a/ui/events/gesture_detection/gesture_provider.cc
+++ b/ui/events/gesture_detection/gesture_provider.cc
@@ -281,7 +281,7 @@ class GestureProvider::GestureListenerImpl
SetIgnoreSingleTap(true);
if (e.GetAction() == MotionEvent::ACTION_DOWN)
- gesture_detector_.set_is_longpress_enabled(true);
+ gesture_detector_.set_longpress_enabled(true);
return gesture_detector_.OnTouchEvent(e);
}
@@ -371,6 +371,17 @@ class GestureProvider::GestureListenerImpl
return true;
}
+ virtual bool OnSwipe(const MotionEvent& e1,
+ const MotionEvent& e2,
+ float velocity_x,
+ float velocity_y) OVERRIDE {
+ GestureEventDetails swipe_details(
+ ET_GESTURE_MULTIFINGER_SWIPE, velocity_x, velocity_y);
+ provider_->Send(
+ CreateGesture(ET_GESTURE_MULTIFINGER_SWIPE, e2, swipe_details));
+ return true;
+ }
+
virtual void OnShowPress(const MotionEvent& e) OVERRIDE {
GestureEventDetails show_press_details(ET_GESTURE_SHOW_PRESS, 0, 0);
provider_->Send(
@@ -425,7 +436,7 @@ class GestureProvider::GestureListenerImpl
virtual bool OnDoubleTapEvent(const MotionEvent& e) OVERRIDE {
switch (e.GetAction()) {
case MotionEvent::ACTION_DOWN:
- gesture_detector_.set_is_longpress_enabled(false);
+ gesture_detector_.set_longpress_enabled(false);
break;
case MotionEvent::ACTION_UP:
« no previous file with comments | « ui/events/gesture_detection/gesture_provider.h ('k') | ui/events/gesture_detection/gesture_provider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698