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

Unified Diff: ash/shelf/shelf_view.cc

Issue 2916983002: shelf: Allow directly dragging items from main shelf to overflow. (Closed)
Patch Set: 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') | ash/shelf/shelf_view_unittest.cc » ('J')
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..dae918888a9b1c9f8f1a28f0c947e3868523e116 100644
--- a/ash/shelf/shelf_view.cc
+++ b/ash/shelf/shelf_view.cc
@@ -1133,10 +1133,26 @@ 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.
+
+ // Determine if we should enter the ripped off state. We should enter if:
msw 2017/06/06 00:27:23 nit: "Mark the item as dragged off the shelf if th
sammiequon 2017/06/06 16:21:26 Done.
+ // 1) The item is dragged more than |kRipOffDistance| from the shelf.
+ // 2) We are on the overflow shelf and the item is dragged onto the main
+ // shelf.
+ // 3) We are on the main shelf and the item is dragged onto the overflow
+ // shelf.
int delta = CalculateShelfDistance(screen_location);
- if (delta > kRipOffDistance) {
+ bool enableRipOff = delta > kRipOffDistance;
msw 2017/06/06 00:27:23 Use the unix_hacker naming convention in Chrome's
sammiequon 2017/06/06 16:21:26 Done.
+ enableRipOff =
+ enableRipOff ||
msw 2017/06/06 00:27:23 nit: if you keep separate statements like this, th
sammiequon 2017/06/06 16:21:26 Done.
+ (is_overflow_mode() &&
+ main_shelf_->GetBoundsForDragInsertInScreen().Contains(screen_location));
+ enableRipOff = enableRipOff || (!is_overflow_mode() && overflow_bubble_ &&
+ overflow_bubble_->IsShowing() &&
+ overflow_bubble_->shelf_view()
+ ->GetBoundsForDragInsertInScreen()
+ .Contains(screen_location));
+
+ if (enableRipOff) {
// 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') | ash/shelf/shelf_view_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698