From e3a682b3f826c18ded918024b62da7e7c4c796f0 Mon Sep 17 00:00:00 2001 From: "sadrul@chromium.org" Date: Fri, 27 Jul 2012 14:48:18 +0000 Subject: gesture recognizer: Fix computing the bounding box of the rectangles. Accumulating all the positions of the touch-events of a single touch-point during its entire lifetime is not very useful. So instead, stop accumulating the positions when the point leaves the manhattan square. BUG=139175 TEST=none TBR=sky@chromium.org Review URL: https://chromiumcodereview.appspot.com/10831043 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@148750 0039d316-1c4b-4281-b951-d872f2087c98 --- ui/base/gestures/gesture_point.cc | 5 ++++- ui/base/gestures/gesture_sequence.cc | 5 +++-- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'ui/base/gestures') diff --git a/ui/base/gestures/gesture_point.cc b/ui/base/gestures/gesture_point.cc index 77988ff..29b3d5a 100644 --- a/ui/base/gestures/gesture_point.cc +++ b/ui/base/gestures/gesture_point.cc @@ -187,7 +187,10 @@ void GesturePoint::UpdateEnclosingRectangle(const TouchEvent& event) { event.GetLocation().y() - radius, radius * 2, radius * 2); - enclosing_rect_ = enclosing_rect_.Union(rect); + if (IsInClickWindow(event)) + enclosing_rect_ = enclosing_rect_.Union(rect); + else + enclosing_rect_ = rect; } } // namespace ui diff --git a/ui/base/gestures/gesture_sequence.cc b/ui/base/gestures/gesture_sequence.cc index c582580..1cf4cba 100644 --- a/ui/base/gestures/gesture_sequence.cc +++ b/ui/base/gestures/gesture_sequence.cc @@ -671,8 +671,9 @@ void GestureSequence::AppendScrollGestureEnd(const GesturePoint& point, void GestureSequence::AppendScrollGestureUpdate(const GesturePoint& point, const gfx::Point& location, Gestures* gestures) { - int dx = location.x() - bounding_box_last_center_.x(); - int dy = location.y() - bounding_box_last_center_.y(); + gfx::Point current_center = bounding_box_.CenterPoint(); + int dx = current_center.x() - bounding_box_last_center_.x(); + int dy = current_center.y() - bounding_box_last_center_.y(); if (dx == 0 && dy == 0) return; if (scroll_type_ == ST_HORIZONTAL) -- cgit v1.1