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 void set_touch_id(unsigned int touch_id) { touch_id_ = touch_id; } | 56 // point_id_ is used to drive GestureSequence::ProcessTouchEventForGesture. |
57 const unsigned int touch_id() const { return touch_id_; } | 57 // point_ids are maintained such that the set of point_ids is always |
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; } | |
58 | 66 |
59 double x_delta() const { | 67 double x_delta() const { |
60 return last_touch_position_.x() - first_touch_position_.x(); | 68 return last_touch_position_.x() - first_touch_position_.x(); |
61 } | 69 } |
62 | 70 |
63 double y_delta() const { | 71 double y_delta() const { |
64 return last_touch_position_.y() - first_touch_position_.y(); | 72 return last_touch_position_.y() - first_touch_position_.y(); |
65 } | 73 } |
66 | 74 |
67 float XVelocity() { return velocity_calculator_.XVelocity(); } | 75 float XVelocity() { return velocity_calculator_.XVelocity(); } |
(...skipping 12 matching lines...) Expand all Loading... | |
80 gfx::Point first_touch_position_; | 88 gfx::Point first_touch_position_; |
81 double first_touch_time_; | 89 double first_touch_time_; |
82 gfx::Point last_touch_position_; | 90 gfx::Point last_touch_position_; |
83 double last_touch_time_; | 91 double last_touch_time_; |
84 | 92 |
85 double last_tap_time_; | 93 double last_tap_time_; |
86 gfx::Point last_tap_position_; | 94 gfx::Point last_tap_position_; |
87 | 95 |
88 VelocityCalculator velocity_calculator_; | 96 VelocityCalculator velocity_calculator_; |
89 | 97 |
90 unsigned int touch_id_; | 98 bool in_use_; |
sadrul
2012/02/23 21:44:14
Remove
tdresser
2012/02/23 22:16:55
Done.
| |
99 int point_id_; | |
91 DISALLOW_COPY_AND_ASSIGN(GesturePoint); | 100 DISALLOW_COPY_AND_ASSIGN(GesturePoint); |
92 }; | 101 }; |
93 | 102 |
94 } // namespace aura | 103 } // namespace aura |
95 | 104 |
96 #endif // UI_AURA_GESTURES_GESTURE_POINT_H_ | 105 #endif // UI_AURA_GESTURES_GESTURE_POINT_H_ |
OLD | NEW |