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

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

Issue 22354005: Add support for maintaining ordinal values through GestureRecognizer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix to fling Created 7 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 569e6b4ee20db7716743d508b2c2962dd4f1cf7c..584ea171338fe17a32f5e11947ad3555198ffac2 100644
--- a/ui/base/gestures/gesture_types.h
+++ b/ui/base/gestures/gesture_types.h
@@ -17,6 +17,9 @@ class TouchEvent;
struct UI_EXPORT GestureEventDetails {
public:
GestureEventDetails(EventType type, float delta_x, float delta_y);
+ GestureEventDetails(EventType type,
+ float delta_x, float delta_y,
+ float delta_x_ordinal, float delta_y_ordinal);
EventType type() const { return type_; }
@@ -26,7 +29,8 @@ 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);
+ void SetScrollVelocity(float velocity_x, float velocity_y,
+ float velocity_x_ordinal, float velocity_y_ordinal);
float scroll_x() const {
CHECK_EQ(ui::ET_GESTURE_SCROLL_UPDATE, type_);
@@ -52,6 +56,33 @@ struct UI_EXPORT GestureEventDetails {
data.scroll_update.velocity_y;
}
+ // *_ordinal values are unmodified by rail based clamping.
+ float scroll_x_ordinal() const {
+ CHECK_EQ(ui::ET_GESTURE_SCROLL_UPDATE, type_);
+ return data.scroll_update.x_ordinal;
+ }
+
+ float scroll_y_ordinal() const {
+ CHECK_EQ(ui::ET_GESTURE_SCROLL_UPDATE, type_);
+ return data.scroll_update.y_ordinal;
+ }
+
+ float velocity_x_ordinal() const {
+ CHECK(type_ == ui::ET_GESTURE_SCROLL_UPDATE ||
+ type_ == ui::ET_SCROLL_FLING_START);
+ return type_ == ui::ET_SCROLL_FLING_START ?
+ data.fling_velocity.x_ordinal :
+ data.scroll_update.velocity_x_ordinal;
+ }
+
+ float velocity_y_ordinal() const {
+ CHECK(type_ == ui::ET_GESTURE_SCROLL_UPDATE ||
+ type_ == ui::ET_SCROLL_FLING_START);
+ return type_ == ui::ET_SCROLL_FLING_START ?
+ data.fling_velocity.y_ordinal :
+ data.scroll_update.velocity_y_ordinal;
+ }
+
int touch_id() const {
CHECK_EQ(ui::ET_GESTURE_LONG_PRESS, type_);
return data.touch_id;
@@ -105,6 +136,10 @@ struct UI_EXPORT GestureEventDetails {
float y;
float velocity_x;
float velocity_y;
+ float x_ordinal;
+ float y_ordinal;
+ float velocity_x_ordinal;
+ float velocity_y_ordinal;
} scroll_update;
float scale; // PINCH scale.
@@ -112,6 +147,8 @@ struct UI_EXPORT GestureEventDetails {
struct { // FLING velocity.
float x;
float y;
+ float x_ordinal;
+ float y_ordinal;
} fling_velocity;
int touch_id; // LONG_PRESS touch-id.
« 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