OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef UI_AURA_GESTURES_GESTURE_POINT_H_ | 5 #ifndef UI_AURA_GESTURES_GESTURE_POINT_H_ |
6 #define UI_AURA_GESTURES_GESTURE_POINT_H_ | 6 #define UI_AURA_GESTURES_GESTURE_POINT_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "ui/aura/gestures/velocity_calculator.h" | 10 #include "ui/aura/gestures/velocity_calculator.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 bool BreaksVerticalRail(); | 46 bool BreaksVerticalRail(); |
47 bool DidScroll(const TouchEvent& event, int distance) const; | 47 bool DidScroll(const TouchEvent& event, int distance) const; |
48 | 48 |
49 const gfx::Point& first_touch_position() const { | 49 const gfx::Point& first_touch_position() const { |
50 return first_touch_position_; | 50 return first_touch_position_; |
51 } | 51 } |
52 | 52 |
53 double last_touch_time() const { return last_touch_time_; } | 53 double last_touch_time() const { return last_touch_time_; } |
54 const gfx::Point& last_touch_position() const { return last_touch_position_; } | 54 const gfx::Point& last_touch_position() const { return last_touch_position_; } |
55 | 55 |
56 // point_id_ is used to drive GestureSequence::ProcessTouchEventForGesture. | 56 void set_touch_id(unsigned int touch_id) { touch_id_ = touch_id; } |
57 // point_ids are maintained such that the set of point_ids is always | 57 unsigned int touch_id() const { return touch_id_; } |
58 // contiguous, from 0 to the number of current touches. | |
59 // A lower point_id indicates that a touch occurred first. | |
60 // A negative point_id indicates that the GesturePoint is not currently | |
61 // associated with a touch. | |
62 void set_point_id(int point_id) { point_id_ = point_id; } | |
63 const int point_id() const { return point_id_; } | |
64 | |
65 const bool in_use() const { return point_id_ >= 0; } | |
66 | 58 |
67 double x_delta() const { | 59 double x_delta() const { |
68 return last_touch_position_.x() - first_touch_position_.x(); | 60 return last_touch_position_.x() - first_touch_position_.x(); |
69 } | 61 } |
70 | 62 |
71 double y_delta() const { | 63 double y_delta() const { |
72 return last_touch_position_.y() - first_touch_position_.y(); | 64 return last_touch_position_.y() - first_touch_position_.y(); |
73 } | 65 } |
74 | 66 |
75 float XVelocity() { return velocity_calculator_.XVelocity(); } | 67 float XVelocity() { return velocity_calculator_.XVelocity(); } |
(...skipping 12 matching lines...) Expand all Loading... |
88 gfx::Point first_touch_position_; | 80 gfx::Point first_touch_position_; |
89 double first_touch_time_; | 81 double first_touch_time_; |
90 gfx::Point last_touch_position_; | 82 gfx::Point last_touch_position_; |
91 double last_touch_time_; | 83 double last_touch_time_; |
92 | 84 |
93 double last_tap_time_; | 85 double last_tap_time_; |
94 gfx::Point last_tap_position_; | 86 gfx::Point last_tap_position_; |
95 | 87 |
96 VelocityCalculator velocity_calculator_; | 88 VelocityCalculator velocity_calculator_; |
97 | 89 |
98 int point_id_; | 90 unsigned int touch_id_; |
99 DISALLOW_COPY_AND_ASSIGN(GesturePoint); | 91 DISALLOW_COPY_AND_ASSIGN(GesturePoint); |
100 }; | 92 }; |
101 | 93 |
102 } // namespace aura | 94 } // namespace aura |
103 | 95 |
104 #endif // UI_AURA_GESTURES_GESTURE_POINT_H_ | 96 #endif // UI_AURA_GESTURES_GESTURE_POINT_H_ |
OLD | NEW |