Chromium Code Reviews| 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/app_list/pagination_controller.h" | 5 #include "ui/app_list/pagination_controller.h" |
| 6 | 6 |
| 7 #include "ui/app_list/pagination_model.h" | 7 #include "ui/app_list/pagination_model.h" |
| 8 #include "ui/events/event.h" | 8 #include "ui/events/event.h" |
| 9 #include "ui/gfx/geometry/rect.h" | 9 #include "ui/gfx/geometry/rect.h" |
| 10 #include "ui/gfx/geometry/vector2d.h" | 10 #include "ui/gfx/geometry/vector2d.h" |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 32 if (scroll_axis_ == SCROLL_AXIS_HORIZONTAL) { | 32 if (scroll_axis_ == SCROLL_AXIS_HORIZONTAL) { |
| 33 // If the view scrolls horizontally, both horizontal and vertical scroll | 33 // If the view scrolls horizontally, both horizontal and vertical scroll |
| 34 // events are valid (since most mouse wheels only have vertical scrolling). | 34 // events are valid (since most mouse wheels only have vertical scrolling). |
| 35 offset_magnitude = | 35 offset_magnitude = |
| 36 abs(offset.x()) > abs(offset.y()) ? offset.x() : offset.y(); | 36 abs(offset.x()) > abs(offset.y()) ? offset.x() : offset.y(); |
| 37 } else { | 37 } else { |
| 38 // If the view scrolls vertically, only vertical scroll events are valid. | 38 // If the view scrolls vertically, only vertical scroll events are valid. |
| 39 offset_magnitude = offset.y(); | 39 offset_magnitude = offset.y(); |
| 40 } | 40 } |
| 41 | 41 |
| 42 // Do not scroll on very small touchpad events. Mouse wheel events should | 42 // Do not scroll on very small events. |
|
Matt Giuca
2016/06/02 08:44:18
// TODO(calamity): Something something https://crb
calamity
2016/06/03 01:25:45
Done.
| |
| 43 // scroll, no matter how small the value change. | 43 if (abs(offset_magnitude) > kMinScrollToSwitchPage) { |
| 44 if (type == SCROLL_MOUSE_WHEEL || | |
| 45 abs(offset_magnitude) > kMinScrollToSwitchPage) { | |
| 46 if (!pagination_model_->has_transition()) { | 44 if (!pagination_model_->has_transition()) { |
| 47 pagination_model_->SelectPageRelative(offset_magnitude > 0 ? -1 : 1, | 45 pagination_model_->SelectPageRelative(offset_magnitude > 0 ? -1 : 1, |
| 48 true); | 46 true); |
| 49 } | 47 } |
| 50 return true; | 48 return true; |
| 51 } | 49 } |
| 52 | 50 |
| 53 return false; | 51 return false; |
| 54 } | 52 } |
| 55 | 53 |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 83 if (fabs(velocity) > kMinHorizVelocityToSwitchPage) | 81 if (fabs(velocity) > kMinHorizVelocityToSwitchPage) |
| 84 pagination_model_->SelectPageRelative(velocity < 0 ? 1 : -1, true); | 82 pagination_model_->SelectPageRelative(velocity < 0 ? 1 : -1, true); |
| 85 return true; | 83 return true; |
| 86 } | 84 } |
| 87 default: | 85 default: |
| 88 return false; | 86 return false; |
| 89 } | 87 } |
| 90 } | 88 } |
| 91 | 89 |
| 92 } // namespace app_list | 90 } // namespace app_list |
| OLD | NEW |