diff options
author | varunjain@chromium.org <varunjain@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-10 22:34:22 +0000 |
---|---|---|
committer | varunjain@chromium.org <varunjain@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-10 22:34:22 +0000 |
commit | 984ad4b32076274757a91e9ac68bd9e3eaf472d2 (patch) | |
tree | ed1cbc4e669d65ca82874716f2ed65f5a51c87db /ash/drag_drop | |
parent | 07d60721d409f246a4f60f6b422a141b5bbd426d (diff) | |
download | chromium_src-984ad4b32076274757a91e9ac68bd9e3eaf472d2.zip chromium_src-984ad4b32076274757a91e9ac68bd9e3eaf472d2.tar.gz chromium_src-984ad4b32076274757a91e9ac68bd9e3eaf472d2.tar.bz2 |
Properly set drag image offset in aura's drag drop controller. Currently the
drag image is always positioned at the mouse cursor.
BUG=118024
TEST=none
Review URL: http://codereview.chromium.org/10044002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@131648 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/drag_drop')
-rw-r--r-- | ash/drag_drop/drag_drop_controller.cc | 8 | ||||
-rw-r--r-- | ash/drag_drop/drag_drop_controller.h | 1 |
2 files changed, 5 insertions, 4 deletions
diff --git a/ash/drag_drop/drag_drop_controller.cc b/ash/drag_drop/drag_drop_controller.cc index 00949c7..8bc0b67 100644 --- a/ash/drag_drop/drag_drop_controller.cc +++ b/ash/drag_drop/drag_drop_controller.cc @@ -27,7 +27,6 @@ namespace internal { using aura::RootWindow; namespace { -const gfx::Point kDragDropWidgetOffset(0, 0); const base::TimeDelta kDragDropAnimationDuration = base::TimeDelta::FromMilliseconds(250); } // namespace @@ -69,13 +68,14 @@ int DragDropController::StartDragAndDrop(const ui::OSExchangeData& data, drag_image_.reset(new DragImageView); drag_image_->SetImage(provider.drag_image()); + drag_image_offset_ = provider.drag_image_offset(); drag_image_->SetScreenBounds(gfx::Rect( - root_location.Add(kDragDropWidgetOffset), + root_location.Subtract(drag_image_offset_), drag_image_->GetPreferredSize())); drag_image_->SetWidgetVisible(true); drag_window_ = NULL; - drag_start_location_ = root_location; + drag_start_location_ = root_location.Subtract(drag_image_offset_); #if !defined(OS_MACOSX) if (should_block_during_drag_drop_) { @@ -122,7 +122,7 @@ void DragDropController::DragUpdate(aura::Window* target, DCHECK(drag_image_.get()); if (drag_image_->visible()) { drag_image_->SetScreenPosition( - event.root_location().Add(kDragDropWidgetOffset)); + event.root_location().Subtract(drag_image_offset_)); } } diff --git a/ash/drag_drop/drag_drop_controller.h b/ash/drag_drop/drag_drop_controller.h index 0a7f075..1bb2503 100644 --- a/ash/drag_drop/drag_drop_controller.h +++ b/ash/drag_drop/drag_drop_controller.h @@ -85,6 +85,7 @@ public: void Cleanup(); scoped_ptr<DragImageView> drag_image_; + gfx::Point drag_image_offset_; const ui::OSExchangeData* drag_data_; int drag_operation_; |