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

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

Issue 10808083: gesture recognizer: Expose bounding-box for the points in a gesture-event. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tot-merge Created 8 years, 5 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_configuration.h ('k') | ui/base/gestures/gesture_types.h » ('j') | 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 e8d5790e3801a8759f0ca572c7ec8aa93bbc930b..c5825800e214d8b8cb664c0fb757b1fb55f5b643 100644
--- a/ui/base/gestures/gesture_sequence.cc
+++ b/ui/base/gestures/gesture_sequence.cc
@@ -493,14 +493,15 @@ void GestureSequence::RecreateBoundingBox() {
for (int i = 0; i < kMaxGesturePoints; ++i) {
if (!points_[i].in_use())
continue;
- if (left > points_[i].x())
- left = points_[i].x();
- if (right < points_[i].x())
- right = points_[i].x();
- if (top > points_[i].y())
- top = points_[i].y();
- if (bottom < points_[i].y())
- bottom = points_[i].y();
+ gfx::Rect rect = points_[i].enclosing_rectangle();
+ if (left > rect.x())
+ left = rect.x();
+ if (right < rect.right())
+ right = rect.right();
+ if (top > rect.y())
+ top = rect.y();
+ if (bottom < rect.bottom())
+ bottom = rect.bottom();
}
bounding_box_last_center_ = bounding_box_.CenterPoint();
bounding_box_.SetRect(left, top, right - left, bottom - top);
@@ -559,6 +560,7 @@ GestureEvent* GestureSequence::CreateGestureEvent(
unsigned int touch_id_bitmask) {
GestureEventDetails gesture_details(details);
gesture_details.set_touch_points(point_count_);
+ gesture_details.set_bounding_box(bounding_box_);
return helper_->CreateGestureEvent(gesture_details, location, flags,
timestamp, touch_id_bitmask);
}
@@ -576,7 +578,7 @@ void GestureSequence::AppendTapDownGestureEvent(const GesturePoint& point,
void GestureSequence::AppendBeginGestureEvent(const GesturePoint& point,
Gestures* gestures) {
gestures->push_back(CreateGestureEvent(
- GestureEventDetails(ui::ET_GESTURE_BEGIN, point_count_, 0),
+ GestureEventDetails(ui::ET_GESTURE_BEGIN, 0, 0),
point.first_touch_position(),
flags_,
base::Time::FromDoubleT(point.last_touch_time()),
@@ -586,7 +588,7 @@ void GestureSequence::AppendBeginGestureEvent(const GesturePoint& point,
void GestureSequence::AppendEndGestureEvent(const GesturePoint& point,
Gestures* gestures) {
gestures->push_back(CreateGestureEvent(
- GestureEventDetails(ui::ET_GESTURE_END, point_count_, 0),
+ GestureEventDetails(ui::ET_GESTURE_END, 0, 0),
point.first_touch_position(),
flags_,
base::Time::FromDoubleT(point.last_touch_time()),
@@ -598,7 +600,7 @@ void GestureSequence::AppendClickGestureEvent(const GesturePoint& point,
gfx::Rect er = point.enclosing_rectangle();
gfx::Point center = er.CenterPoint();
gestures->push_back(CreateGestureEvent(
- GestureEventDetails(ui::ET_GESTURE_TAP, er.width() / 2, er.height() / 2),
+ GestureEventDetails(ui::ET_GESTURE_TAP, 0, 0),
center,
flags_,
base::Time::FromDoubleT(point.last_touch_time()),
« no previous file with comments | « ui/base/gestures/gesture_configuration.h ('k') | ui/base/gestures/gesture_types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698