| 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 10 matching lines...) Expand all Loading... |
| 21 data.fling_velocity.x = delta_x; | 21 data.fling_velocity.x = delta_x; |
| 22 data.fling_velocity.y = delta_y; | 22 data.fling_velocity.y = delta_y; |
| 23 break; | 23 break; |
| 24 | 24 |
| 25 case ui::ET_GESTURE_LONG_PRESS: | 25 case ui::ET_GESTURE_LONG_PRESS: |
| 26 data.touch_id = static_cast<int>(delta_x); | 26 data.touch_id = static_cast<int>(delta_x); |
| 27 CHECK_EQ(0.f, delta_y) << "Unknown data in delta_y for long press."; | 27 CHECK_EQ(0.f, delta_y) << "Unknown data in delta_y for long press."; |
| 28 break; | 28 break; |
| 29 | 29 |
| 30 case ui::ET_GESTURE_PINCH_UPDATE: | 30 case ui::ET_GESTURE_PINCH_UPDATE: |
| 31 data.scale = delta_x; | 31 data.pinch.scale = delta_x; |
| 32 CHECK_EQ(0.f, delta_y) << "Unknown data in delta_y for pinch"; | 32 data.pinch.rotation = delta_y; |
| 33 break; | 33 break; |
| 34 | 34 |
| 35 case ui::ET_GESTURE_MULTIFINGER_SWIPE: | 35 case ui::ET_GESTURE_MULTIFINGER_SWIPE: |
| 36 data.swipe.left = delta_x < 0; | 36 data.swipe.left = delta_x < 0; |
| 37 data.swipe.right = delta_x > 0; | 37 data.swipe.right = delta_x > 0; |
| 38 data.swipe.up = delta_y < 0; | 38 data.swipe.up = delta_y < 0; |
| 39 data.swipe.down = delta_y > 0; | 39 data.swipe.down = delta_y > 0; |
| 40 break; | 40 break; |
| 41 | 41 |
| 42 case ui::ET_GESTURE_TAP: | 42 case ui::ET_GESTURE_TAP: |
| (...skipping 11 matching lines...) Expand all Loading... |
| 54 } | 54 } |
| 55 | 55 |
| 56 void GestureEventDetails::SetScrollVelocity(float velocity_x, | 56 void GestureEventDetails::SetScrollVelocity(float velocity_x, |
| 57 float velocity_y) { | 57 float velocity_y) { |
| 58 CHECK_EQ(ui::ET_GESTURE_SCROLL_UPDATE, type_); | 58 CHECK_EQ(ui::ET_GESTURE_SCROLL_UPDATE, type_); |
| 59 data.scroll_update.velocity_x = velocity_x; | 59 data.scroll_update.velocity_x = velocity_x; |
| 60 data.scroll_update.velocity_y = velocity_y; | 60 data.scroll_update.velocity_y = velocity_y; |
| 61 } | 61 } |
| 62 | 62 |
| 63 } // namespace ui | 63 } // namespace ui |
| OLD | NEW |