Chromium Code Reviews| Index: ui/app_list/views/apps_grid_view.cc |
| diff --git a/ui/app_list/views/apps_grid_view.cc b/ui/app_list/views/apps_grid_view.cc |
| index a465cdc2e8b08e054a417c79a64ada69d437e87e..018f591c63e4028707be9f5de5d18973b706dc2a 100644 |
| --- a/ui/app_list/views/apps_grid_view.cc |
| +++ b/ui/app_list/views/apps_grid_view.cc |
| @@ -244,6 +244,7 @@ AppsGridView::AppsGridView(AppsGridViewDelegate* delegate, |
| drag_pointer_(NONE), |
| drag_and_drop_host_(NULL), |
| forward_events_to_drag_and_drop_host_(false), |
| + drag_start_page_(-1), |
| page_flip_target_(-1), |
| page_flip_delay_in_ms_(kPageFlipDelayInMs), |
| bounds_animator_(this) { |
| @@ -323,6 +324,7 @@ void AppsGridView::InitiateDrag(AppListItemView* view, |
| drag_view_ = view; |
| drag_view_offset_ = event.location(); |
| + drag_start_page_ = pagination_model_->selected_page(); |
| ExtractDragLocation(event, &drag_start_grid_view_); |
| drag_view_start_ = gfx::Point(drag_view_->x(), drag_view_->y()); |
| } |
| @@ -448,6 +450,9 @@ void AppsGridView::EndDrag(bool cancel) { |
| drag_pointer_ = NONE; |
| drop_target_ = Index(); |
| drag_view_ = NULL; |
| + drag_start_grid_view_ = gfx::Point(); |
| + drag_start_page_ = -1; |
| + drag_view_offset_ = gfx::Point(); |
| AnimateToIdealBounds(); |
| StopPageFlipTimer(); |
| @@ -898,11 +903,16 @@ void AppsGridView::ExtractDragLocation(const ui::LocatedEvent& event, |
| void AppsGridView::CalculateDropTarget(const gfx::Point& drag_point, |
| bool use_page_button_hovering) { |
| - const int current_page = pagination_model_->selected_page(); |
| + int current_page = pagination_model_->selected_page(); |
| + gfx::Point point(drag_point); |
| + if (!HitTestPoint(drag_point)) { |
| + point = drag_start_grid_view_; |
| + current_page = drag_start_page_; |
|
xiyuan
2013/07/19 00:59:59
Should we jus return here? Otherwise, this would c
koz (OOO until 15th September)
2013/07/19 04:03:57
That's the intent of this change - to have the dra
xiyuan
2013/07/19 04:36:46
Okay. How about add a threshold for resetting to o
koz (OOO until 15th September)
2013/07/19 08:00:32
Yeah, that sounds good. Including turning the page
|
| + } |
| if (use_page_button_hovering && |
| - page_switcher_view_->bounds().Contains(drag_point)) { |
| - gfx::Point page_switcher_point(drag_point); |
| + page_switcher_view_->bounds().Contains(point)) { |
| + gfx::Point page_switcher_point(point); |
| views::View::ConvertPointToTarget(this, page_switcher_view_, |
| &page_switcher_point); |
| int page = page_switcher_view_->GetPageForPoint(page_switcher_point); |
| @@ -911,9 +921,9 @@ void AppsGridView::CalculateDropTarget(const gfx::Point& drag_point, |
| drop_target_.slot = tiles_per_page() - 1; |
| } |
| } else { |
| - const int drop_row = drag_point.y() / kPreferredTileHeight; |
| + const int drop_row = point.y() / kPreferredTileHeight; |
| const int drop_col = std::min(cols_ - 1, |
| - drag_point.x() / kPreferredTileWidth); |
| + point.x() / kPreferredTileWidth); |
| drop_target_.page = current_page; |
| drop_target_.slot = std::max(0, std::min( |