| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 // MSVC++ requires this to be set before any other includes to get M_PI. | 5 // MSVC++ requires this to be set before any other includes to get M_PI. |
| 6 #define _USE_MATH_DEFINES | 6 #define _USE_MATH_DEFINES |
| 7 | 7 |
| 8 #include "ui/events/gestures/motion_event_aura.h" | 8 #include "ui/events/gestures/motion_event_aura.h" |
| 9 | 9 |
| 10 #include <cmath> | 10 #include <cmath> |
| 11 | 11 |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "ui/events/gestures/gesture_configuration.h" | 13 #include "ui/events/gesture_detection/gesture_configuration.h" |
| 14 | 14 |
| 15 namespace ui { | 15 namespace ui { |
| 16 | 16 |
| 17 MotionEventAura::MotionEventAura() | 17 MotionEventAura::MotionEventAura() |
| 18 : pointer_count_(0), cached_action_index_(-1) { | 18 : pointer_count_(0), cached_action_index_(-1) { |
| 19 } | 19 } |
| 20 | 20 |
| 21 MotionEventAura::MotionEventAura( | 21 MotionEventAura::MotionEventAura( |
| 22 size_t pointer_count, | 22 size_t pointer_count, |
| 23 const base::TimeTicks& last_touch_time, | 23 const base::TimeTicks& last_touch_time, |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 point_data.touch_major = 2.f * radius_x; | 63 point_data.touch_major = 2.f * radius_x; |
| 64 point_data.touch_minor = 2.f * radius_y; | 64 point_data.touch_minor = 2.f * radius_y; |
| 65 point_data.orientation = rotation_angle_rad - M_PI_2; | 65 point_data.orientation = rotation_angle_rad - M_PI_2; |
| 66 } else { | 66 } else { |
| 67 point_data.touch_major = 2.f * radius_y; | 67 point_data.touch_major = 2.f * radius_y; |
| 68 point_data.touch_minor = 2.f * radius_x; | 68 point_data.touch_minor = 2.f * radius_x; |
| 69 point_data.orientation = rotation_angle_rad; | 69 point_data.orientation = rotation_angle_rad; |
| 70 } | 70 } |
| 71 | 71 |
| 72 if (!point_data.touch_major) { | 72 if (!point_data.touch_major) { |
| 73 point_data.touch_major = 2.f * GestureConfiguration::default_radius(); | 73 point_data.touch_major = |
| 74 point_data.touch_minor = 2.f * GestureConfiguration::default_radius(); | 74 2.f * GestureConfiguration::GetInstance()->default_radius(); |
| 75 point_data.touch_minor = |
| 76 2.f * GestureConfiguration::GetInstance()->default_radius(); |
| 75 point_data.orientation = 0; | 77 point_data.orientation = 0; |
| 76 } | 78 } |
| 77 | 79 |
| 78 return point_data; | 80 return point_data; |
| 79 } | 81 } |
| 80 | 82 |
| 81 void MotionEventAura::OnTouch(const TouchEvent& touch) { | 83 void MotionEventAura::OnTouch(const TouchEvent& touch) { |
| 82 switch (touch.type()) { | 84 switch (touch.type()) { |
| 83 case ET_TOUCH_PRESSED: | 85 case ET_TOUCH_PRESSED: |
| 84 AddTouch(touch); | 86 AddTouch(touch); |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 size_t MotionEventAura::GetIndexFromId(int id) const { | 280 size_t MotionEventAura::GetIndexFromId(int id) const { |
| 279 for (size_t i = 0; i < pointer_count_; ++i) { | 281 for (size_t i = 0; i < pointer_count_; ++i) { |
| 280 if (active_touches_[i].touch_id == id) | 282 if (active_touches_[i].touch_id == id) |
| 281 return i; | 283 return i; |
| 282 } | 284 } |
| 283 NOTREACHED(); | 285 NOTREACHED(); |
| 284 return 0; | 286 return 0; |
| 285 } | 287 } |
| 286 | 288 |
| 287 } // namespace ui | 289 } // namespace ui |
| OLD | NEW |