| 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/gfx/point.h" | 11 #include "ui/gfx/point.h" |
| 11 | 12 |
| 12 namespace aura { | 13 namespace aura { |
| 13 class TouchEvent; | 14 class TouchEvent; |
| 14 | 15 |
| 15 // Gesture state. | 16 // Gesture state. |
| 16 enum GestureState { | 17 enum GestureState { |
| 17 GS_NO_GESTURE, | 18 GS_NO_GESTURE, |
| 18 GS_PENDING_SYNTHETIC_CLICK, | 19 GS_PENDING_SYNTHETIC_CLICK, |
| 19 GS_SCROLL, | 20 GS_SCROLL, |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 const gfx::Point& last_touch_position() const { return last_touch_position_; } | 56 const gfx::Point& last_touch_position() const { return last_touch_position_; } |
| 56 | 57 |
| 57 double x_delta() const { | 58 double x_delta() const { |
| 58 return last_touch_position_.x() - first_touch_position_.x(); | 59 return last_touch_position_.x() - first_touch_position_.x(); |
| 59 } | 60 } |
| 60 | 61 |
| 61 double y_delta() const { | 62 double y_delta() const { |
| 62 return last_touch_position_.y() - first_touch_position_.y(); | 63 return last_touch_position_.y() - first_touch_position_.y(); |
| 63 } | 64 } |
| 64 | 65 |
| 65 float x_velocity() const { return x_velocity_; } | 66 float x_velocity() const { return velocity_calculator_.x_velocity(); } |
| 66 float y_velocity() const { return y_velocity_; } | 67 float y_velocity() const { return velocity_calculator_.y_velocity(); } |
| 67 | 68 |
| 68 private: | 69 private: |
| 69 // Various statistical functions to manipulate gestures. | 70 // Various statistical functions to manipulate gestures. |
| 70 bool IsInClickTimeWindow() const; | 71 bool IsInClickTimeWindow() const; |
| 71 bool IsInSecondClickTimeWindow() const; | 72 bool IsInSecondClickTimeWindow() const; |
| 72 bool IsInsideManhattanSquare(const TouchEvent& event) const; | 73 bool IsInsideManhattanSquare(const TouchEvent& event) const; |
| 73 bool IsSecondClickInsideManhattanSquare(const TouchEvent& event) const; | 74 bool IsSecondClickInsideManhattanSquare(const TouchEvent& event) const; |
| 74 bool IsOverMinFlickSpeed() const; | 75 bool IsOverMinFlickSpeed() const; |
| 75 | 76 |
| 76 gfx::Point first_touch_position_; | 77 gfx::Point first_touch_position_; |
| 77 double first_touch_time_; | 78 double first_touch_time_; |
| 78 gfx::Point last_touch_position_; | 79 gfx::Point last_touch_position_; |
| 79 double last_touch_time_; | 80 double last_touch_time_; |
| 80 | 81 |
| 81 double last_tap_time_; | 82 double last_tap_time_; |
| 82 gfx::Point last_tap_position_; | 83 gfx::Point last_tap_position_; |
| 83 | 84 |
| 84 float x_velocity_; | 85 VelocityCalculator velocity_calculator_; |
| 85 float y_velocity_; | |
| 86 | 86 |
| 87 DISALLOW_COPY_AND_ASSIGN(GesturePoint); | 87 DISALLOW_COPY_AND_ASSIGN(GesturePoint); |
| 88 }; | 88 }; |
| 89 | 89 |
| 90 } // namespace aura | 90 } // namespace aura |
| 91 | 91 |
| 92 #endif // UI_AURA_GESTURES_GESTURE_POINT_H_ | 92 #endif // UI_AURA_GESTURES_GESTURE_POINT_H_ |
| OLD | NEW |