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

Unified Diff: ui/base/gestures/gesture_types.h

Issue 10837329: gesture: Include velocity in scroll-update gestures. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 4 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_sequence.cc ('k') | ui/base/gestures/gesture_types.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/gestures/gesture_types.h
diff --git a/ui/base/gestures/gesture_types.h b/ui/base/gestures/gesture_types.h
index 0407954ce92205692eda160c81acba739a385a70..14b73cdf64ec099e7c6232594c1a36241db6a153 100644
--- a/ui/base/gestures/gesture_types.h
+++ b/ui/base/gestures/gesture_types.h
@@ -27,22 +27,30 @@ struct UI_EXPORT GestureEventDetails {
const gfx::Rect& bounding_box() const { return bounding_box_; }
void set_bounding_box(const gfx::Rect& box) { bounding_box_ = box; }
+ void SetScrollVelocity(float velocity_x, float velocity_y);
+
float scroll_x() const {
CHECK_EQ(ui::ET_GESTURE_SCROLL_UPDATE, type_);
- return data.scroll.x;
+ return data.scroll_update.x;
}
+
float scroll_y() const {
CHECK_EQ(ui::ET_GESTURE_SCROLL_UPDATE, type_);
- return data.scroll.y;
+ return data.scroll_update.y;
}
float velocity_x() const {
- CHECK_EQ(ui::ET_SCROLL_FLING_START, type_);
- return data.velocity.x;
+ CHECK(type_ == ui::ET_GESTURE_SCROLL_UPDATE ||
+ type_ == ui::ET_SCROLL_FLING_START);
+ return type_ == ui::ET_SCROLL_FLING_START ? data.fling_velocity.x :
+ data.scroll_update.velocity_x;
}
+
float velocity_y() const {
- CHECK_EQ(ui::ET_SCROLL_FLING_START, type_);
- return data.velocity.y;
+ CHECK(type_ == ui::ET_GESTURE_SCROLL_UPDATE ||
+ type_ == ui::ET_SCROLL_FLING_START);
+ return type_ == ui::ET_SCROLL_FLING_START ? data.fling_velocity.y :
+ data.scroll_update.velocity_y;
}
int touch_id() const {
@@ -59,14 +67,17 @@ struct UI_EXPORT GestureEventDetails {
CHECK_EQ(ui::ET_GESTURE_MULTIFINGER_SWIPE, type_);
return data.swipe.left;
}
+
bool swipe_right() const {
CHECK_EQ(ui::ET_GESTURE_MULTIFINGER_SWIPE, type_);
return data.swipe.right;
}
+
bool swipe_up() const {
CHECK_EQ(ui::ET_GESTURE_MULTIFINGER_SWIPE, type_);
return data.swipe.up;
}
+
bool swipe_down() const {
CHECK_EQ(ui::ET_GESTURE_MULTIFINGER_SWIPE, type_);
return data.swipe.down;
@@ -83,14 +94,16 @@ struct UI_EXPORT GestureEventDetails {
struct { // SCROLL delta.
float x;
float y;
- } scroll;
+ float velocity_x;
+ float velocity_y;
+ } scroll_update;
float scale; // PINCH scale.
struct { // FLING velocity.
float x;
float y;
- } velocity;
+ } fling_velocity;
int touch_id; // LONG_PRESS touch-id.
@@ -102,11 +115,6 @@ struct UI_EXPORT GestureEventDetails {
} swipe;
int tap_count; // TAP repeat count.
-
- struct {
- float delta_x;
- float delta_y;
- } generic;
} data;
int touch_points_; // Number of active touch points in the gesture.
« no previous file with comments | « ui/base/gestures/gesture_sequence.cc ('k') | ui/base/gestures/gesture_types.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698