| 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 dd145ca2d97536bded59c1657b1dcb958a1e1db5..f825000b4f262642be76a8c229383070835eaadd 100644
|
| --- a/ui/app_list/views/apps_grid_view.cc
|
| +++ b/ui/app_list/views/apps_grid_view.cc
|
| @@ -15,6 +15,7 @@
|
| #include "ui/app_list/views/pulsing_block_view.h"
|
| #include "ui/base/animation/animation.h"
|
| #include "ui/base/events/event.h"
|
| +#include "ui/compositor/scoped_layer_animation_settings.h"
|
| #include "ui/views/border.h"
|
| #include "ui/views/view_model_utils.h"
|
| #include "ui/views/widget/widget.h"
|
| @@ -201,14 +202,19 @@ void AppsGridView::InitiateDrag(AppListItemView* view,
|
| // Note: This code has very likely to be changed for Windows (non metro mode)
|
| // when a |drag_and_drop_host_| gets implemented.
|
| if (drag_and_drop_host_) {
|
| + // Determine the mouse offset to the center of the icon so that the drag and
|
| + // drop host follows this layer.
|
| + gfx::Vector2d delta = event.root_location() -
|
| + drag_view_->GetBoundsInScreen().CenterPoint();
|
| + delta.set_y(delta.y() + drag_view_->title()->size().height() / 2);
|
| // We have to hide the original item since the drag and drop host will do
|
| // the OS dependent code to "lift off the dragged item".
|
| - // Note that we cannot use SetVisible since it would remove the mouse input.
|
| - drag_view_->SetSize(gfx::Size());
|
| drag_and_drop_host_->CreateDragIconProxy(event.root_location(),
|
| view->model()->icon(),
|
| drag_view_,
|
| + delta,
|
| kDragAndDropProxyScale);
|
| + HideView(drag_view_, true);
|
| }
|
| drag_start_ = event.location();
|
| }
|
| @@ -244,10 +250,8 @@ void AppsGridView::UpdateDrag(AppListItemView* view,
|
| if (last_drop_target != drop_target_)
|
| AnimateToIdealBounds();
|
|
|
| - if (drag_and_drop_host_) {
|
| + if (drag_and_drop_host_)
|
| drag_and_drop_host_->UpdateDragIconProxy(event.root_location());
|
| - return;
|
| - }
|
|
|
| drag_view_->SetPosition(
|
| gfx::PointAtOffsetFromOrigin(last_drag_point_ - drag_start_));
|
| @@ -263,14 +267,11 @@ void AppsGridView::EndDrag(bool cancel) {
|
| MoveItemInModel(drag_view_, drop_target_);
|
| }
|
|
|
| - // In case we had a drag and drop proxy icon, we delete it and make the real
|
| - // item visible again.
|
| if (drag_and_drop_host_) {
|
| + // If we had a drag and drop proxy icon, we delete it and make the real
|
| + // item visible again.
|
| drag_and_drop_host_->DestroyDragIconProxy();
|
| - // To avoid an incorrect animation on re-group, |drag_view_| gets positioned
|
| - // at its last known drag location.
|
| - drag_view_->SetPosition(
|
| - gfx::PointAtOffsetFromOrigin(last_drag_point_ - drag_start_));
|
| + HideView(drag_view_, false);
|
| }
|
|
|
| drag_pointer_ = NONE;
|
| @@ -919,4 +920,12 @@ void AppsGridView::OnAppListModelStatusChanged() {
|
| SchedulePaint();
|
| }
|
|
|
| +void AppsGridView::HideView(views::View* view, bool hide) {
|
| +#if defined(USE_AURA)
|
| + ui::ScopedLayerAnimationSettings animator(view->layer()->GetAnimator());
|
| + animator.SetPreemptionStrategy(ui::LayerAnimator::IMMEDIATELY_SET_NEW_TARGET);
|
| + view->layer()->SetOpacity(hide ? 0 : 1);
|
| +#endif
|
| +}
|
| +
|
| } // namespace app_list
|
|
|