summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ui/app_list/views/contents_view.cc32
1 files changed, 23 insertions, 9 deletions
diff --git a/ui/app_list/views/contents_view.cc b/ui/app_list/views/contents_view.cc
index 77c8fb0..5167b89 100644
--- a/ui/app_list/views/contents_view.cc
+++ b/ui/app_list/views/contents_view.cc
@@ -6,6 +6,7 @@
#include <algorithm>
+#include "base/logging.h"
#include "ui/app_list/app_list_constants.h"
#include "ui/app_list/pagination_model.h"
#include "ui/app_list/views/app_list_main_view.h"
@@ -182,10 +183,16 @@ bool ContentsView::OnMouseWheel(const ui::MouseWheelEvent& event) {
if (show_state_ != SHOW_APPS)
return false;
- if (abs(event.y_offset()) > kMinMouseWheelToSwitchPage) {
+ int offset;
+ if (abs(event.x_offset()) > abs(event.y_offset()))
+ offset = event.x_offset();
+ else
+ offset = event.y_offset();
+
+ if (abs(offset) > kMinMouseWheelToSwitchPage) {
if (!pagination_model_->has_transition()) {
pagination_model_->SelectPageRelative(
- event.y_offset() > 0 ? -1 : 1, true);
+ offset > 0 ? -1 : 1, true);
}
return true;
}
@@ -231,17 +238,24 @@ void ContentsView::OnGestureEvent(ui::GestureEvent* event) {
void ContentsView::OnScrollEvent(ui::ScrollEvent* event) {
if (show_state_ != SHOW_APPS ||
- event->type() == ui::ET_SCROLL_FLING_CANCEL ||
- abs(event->x_offset()) < kMinScrollToSwitchPage) {
+ event->type() == ui::ET_SCROLL_FLING_CANCEL) {
return;
}
- if (!pagination_model_->has_transition()) {
- pagination_model_->SelectPageRelative(event->x_offset() > 0 ? -1 : 1,
- true);
+ float offset;
+ if (abs(event->x_offset()) > abs(event->y_offset()))
+ offset = event->x_offset();
+ else
+ offset = event->y_offset();
+
+ if (abs(offset) > kMinScrollToSwitchPage) {
+ if (!pagination_model_->has_transition()) {
+ pagination_model_->SelectPageRelative(offset > 0 ? -1 : 1,
+ true);
+ }
+ event->SetHandled();
+ event->StopPropagation();
}
- event->SetHandled();
- event->StopPropagation();
}
} // namespace app_list