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/gesture_detection/gesture_detector.h" | 8 #include "ui/events/gesture_detection/gesture_detector.h" |
9 | 9 |
10 #include <stddef.h> | 10 #include <stddef.h> |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 sum_y += ev.GetY(i); | 171 sum_y += ev.GetY(i); |
172 } | 172 } |
173 const int div = pointer_up ? count - 1 : count; | 173 const int div = pointer_up ? count - 1 : count; |
174 const float focus_x = sum_x / div; | 174 const float focus_x = sum_x / div; |
175 const float focus_y = sum_y / div; | 175 const float focus_y = sum_y / div; |
176 | 176 |
177 bool handled = false; | 177 bool handled = false; |
178 | 178 |
179 switch (action) { | 179 switch (action) { |
180 case MotionEvent::ACTION_NONE: | 180 case MotionEvent::ACTION_NONE: |
| 181 case MotionEvent::ACTION_HOVER_ENTER: |
| 182 case MotionEvent::ACTION_HOVER_EXIT: |
| 183 case MotionEvent::ACTION_HOVER_MOVE: |
| 184 case MotionEvent::ACTION_BUTTON_PRESS: |
| 185 case MotionEvent::ACTION_BUTTON_RELEASE: |
181 NOTREACHED(); | 186 NOTREACHED(); |
182 return handled; | 187 return handled; |
183 | 188 |
184 case MotionEvent::ACTION_POINTER_DOWN: { | 189 case MotionEvent::ACTION_POINTER_DOWN: { |
185 down_focus_x_ = last_focus_x_ = focus_x; | 190 down_focus_x_ = last_focus_x_ = focus_x; |
186 down_focus_y_ = last_focus_y_ = focus_y; | 191 down_focus_y_ = last_focus_y_ = focus_y; |
187 // Cancel long press and taps. | 192 // Cancel long press and taps. |
188 CancelTaps(); | 193 CancelTaps(); |
189 maximum_pointer_count_ = std::max(maximum_pointer_count_, | 194 maximum_pointer_count_ = std::max(maximum_pointer_count_, |
190 static_cast<int>(ev.GetPointerCount())); | 195 static_cast<int>(ev.GetPointerCount())); |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
580 for (size_t i = 0; i < secondary_pointer_down_event.GetPointerCount(); i++) { | 585 for (size_t i = 0; i < secondary_pointer_down_event.GetPointerCount(); i++) { |
581 if (secondary_pointer_down_event.GetPointerId(i) == pointer_id) | 586 if (secondary_pointer_down_event.GetPointerId(i) == pointer_id) |
582 return &secondary_pointer_down_event; | 587 return &secondary_pointer_down_event; |
583 } | 588 } |
584 | 589 |
585 NOTREACHED(); | 590 NOTREACHED(); |
586 return nullptr; | 591 return nullptr; |
587 } | 592 } |
588 | 593 |
589 } // namespace ui | 594 } // namespace ui |
OLD | NEW |