Index: ui/aura/event.h |
=================================================================== |
--- ui/aura/event.h (revision 126124) |
+++ ui/aura/event.h (working copy) |
@@ -294,8 +294,7 @@ |
int flags) |
: MouseEvent(model, source, target, type, flags), |
x_offset_(model.x_offset_), |
- y_offset_(model.y_offset_) { |
- } |
+ y_offset_(model.y_offset_) {} |
float x_offset() const { return x_offset_; } |
float y_offset() const { return y_offset_; } |
@@ -309,25 +308,56 @@ |
class AURA_EXPORT GestureEvent : public LocatedEvent { |
public: |
+ // Bundles properties of a gesture event and allows |
+ // for a uniform c'tor signature for GestureEvent. |
+ // REMARK(tvoss): Instead of modelling "isolated" fields |
+ // in this property, a 3x3 transformation matrix might be |
+ // more appropriate. |
+ struct Properties { |
+ Properties() |
+ : point_id(-1), |
+ delta_x(0.f), |
+ delta_y(0.f), |
+ scale_x(1.f), |
+ scale_y(1.f) { |
+ } |
+ |
+ // Point or touch-id in case of long-press gestures. |
+ int point_id; |
+ |
+ // For drag gestures |
+ float delta_x; |
+ float delta_y; |
+ |
+ // For pinch gestures |
+ float scale_x; |
+ float scale_y; |
+ }; |
+ |
GestureEvent(ui::EventType type, |
int x, |
int y, |
int flags, |
base::Time time_stamp, |
- float delta_x, |
- float delta_y); |
+ const Properties& properties); |
// Create a new TouchEvent which is identical to the provided model. |
// If source / target windows are provided, the model location will be |
// converted from |source| coordinate system to |target| coordinate system. |
GestureEvent(const GestureEvent& model, Window* source, Window* target); |
- float delta_x() const { return delta_x_; } |
- float delta_y() const { return delta_y_; } |
+ int point_id() const { return properties_.point_id; } |
+ float delta_x() const { return properties_.delta_x; } |
+ float delta_y() const { return properties_.delta_y; } |
+ |
+ float scale_x() const { return properties_.scale_x; } |
+ float scale_y() const { return properties_.scale_y; } |
+ |
+ const Properties& properties() const { return properties_; } |
+ |
private: |
- float delta_x_; |
- float delta_y_; |
+ Properties properties_; |
DISALLOW_COPY_AND_ASSIGN(GestureEvent); |
}; |