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,22 +1652,30 @@ void AppsGridView::MaybeStartPageFlipTimer(const gfx::Point& drag_point) {
StopPageFlipTimer();
int new_page_flip_target = -1;
if (page_switcher_view_ &&
page_switcher_view_->bounds().Contains(drag_point)) {
gfx::Point page_switcher_point(drag_point);
views::View::ConvertPointToTarget(this, page_switcher_view_,
&page_switcher_point);
new_page_flip_target =
page_switcher_view_->GetPageForPoint(page_switcher_point);
}
// Drag zones are at the edges of the scroll axis.
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);
views::View::ConvertPointToTarget(
this, page_switcher_view_, &page_switcher_point);
new_page_flip_target =
page_switcher_view_->GetPageForPoint(page_switcher_point);
}
// TODO(xiyuan): Fix this for RTL.
if (new_page_flip_target == -1 && drag_point.x() < kPageFlipZoneSize)
new_page_flip_target = pagination_model_.selected_page() - 1;
// TODO(xiyuan): Fix this for RTL.
if (new_page_flip_target == -1 && drag_point.x() < kPageFlipZoneSize)
new_page_flip_target = pagination_model_.selected_page() - 1;
if (new_page_flip_target == -1 &&
drag_point.x() > width() - kPageFlipZoneSize) {
new_page_flip_target = pagination_model_.selected_page() + 1;
if (new_page_flip_target == -1 &&
drag_point.x() > width() - kPageFlipZoneSize) {
new_page_flip_target = pagination_model_.selected_page() + 1;
}
}
if (new_page_flip_target == page_flip_target_)
......
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