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 #include "ui/events/gestures/gesture_provider_aura.h" | 5 #include "ui/events/gestures/gesture_provider_aura.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "ui/events/event.h" | 9 #include "ui/events/event.h" |
10 #include "ui/events/gesture_detection/gesture_config_helper.h" | 10 #include "ui/events/gesture_detection/gesture_config_helper.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 } | 21 } |
22 | 22 |
23 GestureProviderAura::~GestureProviderAura() {} | 23 GestureProviderAura::~GestureProviderAura() {} |
24 | 24 |
25 bool GestureProviderAura::OnTouchEvent(const TouchEvent& event) { | 25 bool GestureProviderAura::OnTouchEvent(const TouchEvent& event) { |
26 bool pointer_id_is_active = false; | 26 bool pointer_id_is_active = false; |
27 for (size_t i = 0; i < pointer_state_.GetPointerCount(); ++i) { | 27 for (size_t i = 0; i < pointer_state_.GetPointerCount(); ++i) { |
28 if (event.touch_id() != pointer_state_.GetPointerId(i)) | 28 if (event.touch_id() != pointer_state_.GetPointerId(i)) |
29 continue; | 29 continue; |
30 pointer_id_is_active = true; | 30 pointer_id_is_active = true; |
| 31 |
| 32 // If this is a touchmove event, and it isn't different from the last |
| 33 // event, ignore it. |
| 34 if (event.type() == ET_TOUCH_MOVED && |
| 35 event.x() == pointer_state_.GetX(i) && |
| 36 event.y() == pointer_state_.GetY(i)) { |
| 37 return false; |
| 38 } |
31 break; | 39 break; |
32 } | 40 } |
33 | 41 |
34 if (event.type() == ET_TOUCH_PRESSED && pointer_id_is_active) { | 42 if (event.type() == ET_TOUCH_PRESSED && pointer_id_is_active) { |
35 // Ignore touch press events if we already believe the pointer is down. | 43 // Ignore touch press events if we already believe the pointer is down. |
36 return false; | 44 return false; |
37 } else if (event.type() != ET_TOUCH_PRESSED && !pointer_id_is_active) { | 45 } else if (event.type() != ET_TOUCH_PRESSED && !pointer_id_is_active) { |
38 // We could have an active touch stream transfered to us, resulting in touch | 46 // We could have an active touch stream transfered to us, resulting in touch |
39 // move or touch up events without associated touch down events. Ignore | 47 // move or touch up events without associated touch down events. Ignore |
40 // them. | 48 // them. |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 | 135 |
128 double double_tap_slop_square = | 136 double double_tap_slop_square = |
129 GestureConfiguration::max_distance_between_taps_for_double_tap(); | 137 GestureConfiguration::max_distance_between_taps_for_double_tap(); |
130 double_tap_slop_square *= double_tap_slop_square; | 138 double_tap_slop_square *= double_tap_slop_square; |
131 const float delta_x = previous_tap.x - current_tap.x; | 139 const float delta_x = previous_tap.x - current_tap.x; |
132 const float delta_y = previous_tap.y - current_tap.y; | 140 const float delta_y = previous_tap.y - current_tap.y; |
133 return (delta_x * delta_x + delta_y * delta_y < double_tap_slop_square); | 141 return (delta_x * delta_x + delta_y * delta_y < double_tap_slop_square); |
134 } | 142 } |
135 | 143 |
136 } // namespace content | 144 } // namespace content |
OLD | NEW |