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 std::max(event.radius_x(), event.radius_y()) * 2 == | |
38 pointer_state_.GetTouchMajor(i) && | |
39 event.force() == pointer_state_.GetPressure(i)) { | |
jdduke (slow)
2014/07/30 15:29:32
How noisy are force/radius values compared to posi
tdresser
2014/07/31 15:33:31
The amount of noise depends entirely on the firmwa
jdduke (slow)
2014/07/31 16:19:02
It's not that I feel strongly about it, more so th
tdresser
2014/08/01 13:35:32
Done.
| |
40 return false; | |
41 } | |
31 break; | 42 break; |
32 } | 43 } |
33 | 44 |
34 if (event.type() == ET_TOUCH_PRESSED && pointer_id_is_active) { | 45 if (event.type() == ET_TOUCH_PRESSED && pointer_id_is_active) { |
35 // Ignore touch press events if we already believe the pointer is down. | 46 // Ignore touch press events if we already believe the pointer is down. |
36 return false; | 47 return false; |
37 } else if (event.type() != ET_TOUCH_PRESSED && !pointer_id_is_active) { | 48 } 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 | 49 // 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 | 50 // move or touch up events without associated touch down events. Ignore |
40 // them. | 51 // them. |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
127 | 138 |
128 double double_tap_slop_square = | 139 double double_tap_slop_square = |
129 GestureConfiguration::max_distance_between_taps_for_double_tap(); | 140 GestureConfiguration::max_distance_between_taps_for_double_tap(); |
130 double_tap_slop_square *= double_tap_slop_square; | 141 double_tap_slop_square *= double_tap_slop_square; |
131 const float delta_x = previous_tap.x - current_tap.x; | 142 const float delta_x = previous_tap.x - current_tap.x; |
132 const float delta_y = previous_tap.y - current_tap.y; | 143 const float delta_y = previous_tap.y - current_tap.y; |
133 return (delta_x * delta_x + delta_y * delta_y < double_tap_slop_square); | 144 return (delta_x * delta_x + delta_y * delta_y < double_tap_slop_square); |
134 } | 145 } |
135 | 146 |
136 } // namespace content | 147 } // namespace content |
OLD | NEW |