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 #include "ui/base/gestures/gesture_types.h" | 5 #include "ui/base/gestures/gesture_types.h" |
6 | 6 |
7 namespace ui { | 7 namespace ui { |
8 | 8 |
9 GestureEventDetails::GestureEventDetails(ui::EventType type, | 9 GestureEventDetails::GestureEventDetails(ui::EventType type, |
10 float delta_x, | 10 float delta_x, |
(...skipping 15 matching lines...) Expand all Loading... |
26 data.radius.y = delta_y; | 26 data.radius.y = delta_y; |
27 break; | 27 break; |
28 | 28 |
29 case ui::ET_GESTURE_LONG_PRESS: | 29 case ui::ET_GESTURE_LONG_PRESS: |
30 data.touch_id = static_cast<int>(delta_x); | 30 data.touch_id = static_cast<int>(delta_x); |
31 CHECK_EQ(0.f, delta_y) << "Unknown data in delta_y for long press."; | 31 CHECK_EQ(0.f, delta_y) << "Unknown data in delta_y for long press."; |
32 break; | 32 break; |
33 | 33 |
34 case ui::ET_GESTURE_BEGIN: | 34 case ui::ET_GESTURE_BEGIN: |
35 case ui::ET_GESTURE_END: | 35 case ui::ET_GESTURE_END: |
36 data.touch_points = static_cast<int>(delta_x); | 36 set_touch_points(static_cast<int>(delta_x)); |
37 CHECK_EQ(0.f, delta_y) << "Unknown data in delta_y for begin/end"; | 37 CHECK_EQ(0.f, delta_y) << "Unknown data in delta_y for begin/end"; |
38 break; | 38 break; |
39 | 39 |
40 case ui::ET_GESTURE_PINCH_UPDATE: | 40 case ui::ET_GESTURE_PINCH_UPDATE: |
41 data.scale = delta_x; | 41 data.scale = delta_x; |
42 CHECK_EQ(0.f, delta_y) << "Unknown data in delta_y for pinch"; | 42 CHECK_EQ(0.f, delta_y) << "Unknown data in delta_y for pinch"; |
43 break; | 43 break; |
44 | 44 |
45 case ui::ET_GESTURE_MULTIFINGER_SWIPE: | 45 case ui::ET_GESTURE_MULTIFINGER_SWIPE: |
46 data.swipe.left = delta_x < 0; | 46 data.swipe.left = delta_x < 0; |
47 data.swipe.right = delta_x > 0; | 47 data.swipe.right = delta_x > 0; |
48 data.swipe.up = delta_y < 0; | 48 data.swipe.up = delta_y < 0; |
49 data.swipe.down = delta_y > 0; | 49 data.swipe.down = delta_y > 0; |
50 break; | 50 break; |
51 | 51 |
52 default: | 52 default: |
53 data.generic.delta_x = delta_x; | 53 data.generic.delta_x = delta_x; |
54 data.generic.delta_y = delta_y; | 54 data.generic.delta_y = delta_y; |
55 if (delta_x != 0.f || delta_y != 0.f) { | 55 if (delta_x != 0.f || delta_y != 0.f) { |
56 DLOG(WARNING) << "A gesture event (" << type << ") had unknown data: (" | 56 DLOG(WARNING) << "A gesture event (" << type << ") had unknown data: (" |
57 << delta_x << "," << delta_y; | 57 << delta_x << "," << delta_y; |
58 } | 58 } |
59 break; | 59 break; |
60 } | 60 } |
61 } | 61 } |
62 | 62 |
63 } // namespace ui | 63 } // namespace ui |
OLD | NEW |