summaryrefslogtreecommitdiffstats
path: root/ui/base/gestures
diff options
context:
space:
mode:
authorsadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-27 14:48:18 +0000
committersadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-27 14:48:18 +0000
commite3a682b3f826c18ded918024b62da7e7c4c796f0 (patch)
tree9acbc5ab1cd76adbe7285c4debc5682c9e12df65 /ui/base/gestures
parent403bd250e794f8dfa1f9e17c4c1f511118b69ac4 (diff)
downloadchromium_src-e3a682b3f826c18ded918024b62da7e7c4c796f0.zip
chromium_src-e3a682b3f826c18ded918024b62da7e7c4c796f0.tar.gz
chromium_src-e3a682b3f826c18ded918024b62da7e7c4c796f0.tar.bz2
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
Diffstat (limited to 'ui/base/gestures')
-rw-r--r--ui/base/gestures/gesture_point.cc5
-rw-r--r--ui/base/gestures/gesture_sequence.cc5
2 files changed, 7 insertions, 3 deletions
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)