Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(667)

Unified Diff: ash/shelf/shelf_view.cc

Issue 2916983002: shelf: Allow directly dragging items from main shelf to overflow. (Closed)
Patch Set: Fixed patch set 1 errors. Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ash/shelf/shelf_view_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/shelf/shelf_view.cc
diff --git a/ash/shelf/shelf_view.cc b/ash/shelf/shelf_view.cc
index 7304bd833f8478e2823df4c978aca5b965e8ca8a..c11b9eb760a24622b65c0611786470016a2c0d56 100644
--- a/ash/shelf/shelf_view.cc
+++ b/ash/shelf/shelf_view.cc
@@ -1133,10 +1133,21 @@ bool ShelfView::HandleRipOffDrag(const ui::LocatedEvent& event) {
UpdateDragIconProxy(screen_location);
return true;
}
- // Check if we are too far away from the shelf to enter the ripped off state.
- // Determine the distance to the shelf.
+
+ // Mark the item as dragged off the shelf if the drag distance exceeds
+ // |kRipOffDistance|, or if it's dragged between the main and overflow shelf.
int delta = CalculateShelfDistance(screen_location);
- if (delta > kRipOffDistance) {
+ bool dragged_off_shelf = delta > kRipOffDistance;
+ dragged_off_shelf |=
+ (is_overflow_mode() &&
+ main_shelf_->GetBoundsForDragInsertInScreen().Contains(screen_location));
+ dragged_off_shelf |= (!is_overflow_mode() && overflow_bubble_ &&
+ overflow_bubble_->IsShowing() &&
+ overflow_bubble_->shelf_view()
+ ->GetBoundsForDragInsertInScreen()
+ .Contains(screen_location));
+
+ if (dragged_off_shelf) {
// Create a proxy view item which can be moved anywhere.
CreateDragIconProxy(event.root_location(), drag_view_->GetImage(),
drag_view_, gfx::Vector2d(0, 0),
« no previous file with comments | « no previous file | ash/shelf/shelf_view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698