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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 // point_id_ is used to drive GestureSequence::ProcessTouchEventForGesture. |
57 // point_ids are maintained such that the set of point_ids is always | 57 // point_ids are maintained such that the set of point_ids is always |
58 // contiguous, from 0 to the number of current touches. | 58 // contiguous, from 0 to the number of current touches. |
59 // A lower point_id indicates that a touch occurred first. | 59 // A lower point_id indicates that a touch occurred first. |
60 // A negative point_id indicates that the GesturePoint is not currently | 60 // A negative point_id indicates that the GesturePoint is not currently |
61 // associated with a touch. | 61 // associated with a touch. |
62 void set_point_id(int point_id) { point_id_ = point_id; } | 62 void set_point_id(int point_id) { point_id_ = point_id; } |
63 const int point_id() const { return point_id_; } | 63 int point_id() const { return point_id_; } |
64 | 64 |
65 const bool in_use() const { return point_id_ >= 0; } | 65 bool in_use() const { return point_id_ >= 0; } |
66 | 66 |
67 double x_delta() const { | 67 double x_delta() const { |
68 return last_touch_position_.x() - first_touch_position_.x(); | 68 return last_touch_position_.x() - first_touch_position_.x(); |
69 } | 69 } |
70 | 70 |
71 double y_delta() const { | 71 double y_delta() const { |
72 return last_touch_position_.y() - first_touch_position_.y(); | 72 return last_touch_position_.y() - first_touch_position_.y(); |
73 } | 73 } |
74 | 74 |
75 float XVelocity() { return velocity_calculator_.XVelocity(); } | 75 float XVelocity() { return velocity_calculator_.XVelocity(); } |
(...skipping 19 matching lines...) Expand all Loading... |
95 | 95 |
96 VelocityCalculator velocity_calculator_; | 96 VelocityCalculator velocity_calculator_; |
97 | 97 |
98 int point_id_; | 98 int point_id_; |
99 DISALLOW_COPY_AND_ASSIGN(GesturePoint); | 99 DISALLOW_COPY_AND_ASSIGN(GesturePoint); |
100 }; | 100 }; |
101 | 101 |
102 } // namespace aura | 102 } // namespace aura |
103 | 103 |
104 #endif // UI_AURA_GESTURES_GESTURE_POINT_H_ | 104 #endif // UI_AURA_GESTURES_GESTURE_POINT_H_ |
OLD | NEW |