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

Unified Diff: ui/base/gestures/gesture_sequence.cc

Issue 10191006: gesture recognizer: Reset velocities of the fingers after a pinch-end/swipe-end. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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
« no previous file with comments | « ui/base/gestures/gesture_point.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/gestures/gesture_sequence.cc
diff --git a/ui/base/gestures/gesture_sequence.cc b/ui/base/gestures/gesture_sequence.cc
index fcab299e103e4b4b69563a53584497dbb4f9ee67..738d93fc3b9b0377ad0a1298488d883c4ee706d7 100644
--- a/ui/base/gestures/gesture_sequence.cc
+++ b/ui/base/gestures/gesture_sequence.cc
@@ -269,6 +269,9 @@ GestureSequence::Gestures* GestureSequence::ProcessTouchEventForGesture(
case GST_THREE_FINGER_SWIPE_FIRST_CANCELLED:
case GST_THREE_FINGER_SWIPE_SECOND_CANCELLED:
case GST_THREE_FINGER_SWIPE_THIRD_CANCELLED:
+ GetPointByPointId(0)->ResetVelocity();
+ GetPointByPointId(1)->ResetVelocity();
+ GetPointByPointId(2)->ResetVelocity();
set_state(GS_PINCH);
break;
case GST_THREE_FINGER_SWIPE_FIRST_MOVED:
@@ -651,13 +654,16 @@ bool GestureSequence::PinchEnd(const TouchEvent& event,
const GesturePoint& point, Gestures* gestures) {
DCHECK(state_ == GS_PINCH);
- const GesturePoint* point1 = GetPointByPointId(0);
- const GesturePoint* point2 = GetPointByPointId(1);
+ GesturePoint* point1 = GetPointByPointId(0);
+ GesturePoint* point2 = GetPointByPointId(1);
float distance = point1->Distance(*point2);
AppendPinchGestureEnd(*point1, *point2,
distance / pinch_distance_start_, gestures);
+ point1->ResetVelocity();
+ point2->ResetVelocity();
+
pinch_distance_start_ = 0;
pinch_distance_current_ = 0;
return true;
« no previous file with comments | « ui/base/gestures/gesture_point.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698