public:
GestureEventDetails();
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_; }
void set_bounding_box(const gfx::RectF& box) { bounding_box_ = box; }
- void SetScrollVelocity(float velocity_x, float velocity_y,
- float velocity_x_ordinal, float velocity_y_ordinal);
-
float scroll_x_hint() const {
DCHECK_EQ(ui::ET_GESTURE_SCROLL_BEGIN, type_);
return data.scroll_begin.x_hint;
}
float velocity_x() const {
- DCHECK(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;
+ DCHECK(type_ == ui::ET_SCROLL_FLING_START);
+ return data.fling_velocity.x;
}
float velocity_y() const {
- DCHECK(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;
- }
-
- // *_ordinal values are unmodified by rail based clamping.
- float scroll_x_ordinal() const {
- DCHECK_EQ(ui::ET_GESTURE_SCROLL_UPDATE, type_);
- return data.scroll_update.x_ordinal;
- }
-
- float scroll_y_ordinal() const {
- DCHECK_EQ(ui::ET_GESTURE_SCROLL_UPDATE, type_);
- return data.scroll_update.y_ordinal;
- }
-
- float velocity_x_ordinal() const {
- DCHECK(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 {
- DCHECK(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 {
- DCHECK_EQ(ui::ET_GESTURE_LONG_PRESS, type_);
- return data.touch_id;
+ DCHECK(type_ == ui::ET_SCROLL_FLING_START);
+ return data.fling_velocity.y;
}
float first_finger_width() const {
struct { // SCROLL delta.
float x;
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.
struct { // FLING velocity.
float x;
float y;
- float x_ordinal;
- float y_ordinal;
} fling_velocity;
- int touch_id; // LONG_PRESS touch-id.
-
// Dimensions of the first finger's enclosing rectangle for
// TWO_FINGER_TAP.
struct {