Commit 2014111c authored by calamity's avatar calamity Committed by Commit bot

Make page switch on drag happen at top and bottom for experimental app list.

This CL makes dragging an app in the experimental app list change pages at
the top and bottom of the apps grid rather than at the sides. This matches
the scroll behavior of the experimental app list.

BUG=406222

Review URL: https://codereview.chromium.org/518673008

Cr-Commit-Position: refs/heads/master@{#293673}
parent 1e9a7b14
...@@ -1652,11 +1652,18 @@ void AppsGridView::MaybeStartPageFlipTimer(const gfx::Point& drag_point) { ...@@ -1652,11 +1652,18 @@ void AppsGridView::MaybeStartPageFlipTimer(const gfx::Point& drag_point) {
StopPageFlipTimer(); StopPageFlipTimer();
int new_page_flip_target = -1; int new_page_flip_target = -1;
if (page_switcher_view_ && // Drag zones are at the edges of the scroll axis.
page_switcher_view_->bounds().Contains(drag_point)) { if (pagination_controller_->scroll_axis() ==
PaginationController::SCROLL_AXIS_VERTICAL) {
if (drag_point.y() < kPageFlipZoneSize)
new_page_flip_target = pagination_model_.selected_page() - 1;
else if (drag_point.y() > height() - kPageFlipZoneSize)
new_page_flip_target = pagination_model_.selected_page() + 1;
} else {
if (page_switcher_view_->bounds().Contains(drag_point)) {
gfx::Point page_switcher_point(drag_point); gfx::Point page_switcher_point(drag_point);
views::View::ConvertPointToTarget(this, page_switcher_view_, views::View::ConvertPointToTarget(
&page_switcher_point); this, page_switcher_view_, &page_switcher_point);
new_page_flip_target = new_page_flip_target =
page_switcher_view_->GetPageForPoint(page_switcher_point); page_switcher_view_->GetPageForPoint(page_switcher_point);
} }
...@@ -1669,6 +1676,7 @@ void AppsGridView::MaybeStartPageFlipTimer(const gfx::Point& drag_point) { ...@@ -1669,6 +1676,7 @@ void AppsGridView::MaybeStartPageFlipTimer(const gfx::Point& drag_point) {
drag_point.x() > width() - kPageFlipZoneSize) { drag_point.x() > width() - kPageFlipZoneSize) {
new_page_flip_target = pagination_model_.selected_page() + 1; new_page_flip_target = pagination_model_.selected_page() + 1;
} }
}
if (new_page_flip_target == page_flip_target_) if (new_page_flip_target == page_flip_target_)
return; return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment