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

Unified Diff: ash/shelf/shelf_view.cc

Issue 338833008: Require the cursor to move a minimum distance after the mouse press before initiating a mouse drag (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | « ash/shelf/shelf_view.h ('k') | 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 0ef9b405589d1895ec23641589eed641d48d6e67..60936f6b66b0fc0086a80acd40918e3747b022bd 100644
--- a/ash/shelf/shelf_view.cc
+++ b/ash/shelf/shelf_view.cc
@@ -379,7 +379,6 @@ ShelfView::ShelfView(ShelfModel* model,
owner_overflow_bubble_(NULL),
drag_pointer_(NONE),
drag_view_(NULL),
- drag_offset_(0),
start_drag_index_(-1),
context_menu_id_(0),
leading_inset_(kDefaultLeadingInset),
@@ -970,7 +969,7 @@ void ShelfView::ContinueDrag(const ui::LocatedEvent& event) {
int x = 0, y = 0;
if (layout_manager_->IsHorizontalAlignment()) {
x = std::max(view_model_->ideal_bounds(indices.first).x(),
- drag_point.x() - drag_offset_);
+ drag_point.x() - drag_origin_.x());
x = std::min(view_model_->ideal_bounds(last_drag_index).right() -
view_model_->ideal_bounds(current_index).width(),
x);
@@ -979,7 +978,7 @@ void ShelfView::ContinueDrag(const ui::LocatedEvent& event) {
drag_view_->SetX(x);
} else {
y = std::max(view_model_->ideal_bounds(indices.first).y(),
- drag_point.y() - drag_offset_);
+ drag_point.y() - drag_origin_.y());
y = std::min(view_model_->ideal_bounds(last_drag_index).bottom() -
view_model_->ideal_bounds(current_index).height(),
y);
@@ -1574,7 +1573,7 @@ void ShelfView::PointerPressedOnButton(views::View* view,
return; // View is being deleted or not draggable, ignore request.
drag_view_ = view;
- drag_offset_ = layout_manager_->PrimaryAxisValue(event.x(), event.y());
+ drag_origin_ = gfx::Point(event.x(), event.y());
UMA_HISTOGRAM_ENUMERATION("Ash.ShelfAlignmentUsage",
layout_manager_->SelectValueForShelfAlignment(
SHELF_ALIGNMENT_UMA_ENUM_VALUE_BOTTOM,
@@ -1590,8 +1589,8 @@ void ShelfView::PointerDraggedOnButton(views::View* view,
// To prepare all drag types (moving an item in the shelf and dragging off),
// we should check the x-axis and y-axis offset.
if (!dragging() && drag_view_ &&
- ((std::abs(event.x() - drag_offset_) >= kMinimumDragDistance) ||
- (std::abs(event.y() - drag_offset_) >= kMinimumDragDistance))) {
+ ((std::abs(event.x() - drag_origin_.x()) >= kMinimumDragDistance) ||
+ (std::abs(event.y() - drag_origin_.y()) >= kMinimumDragDistance))) {
PrepareForDrag(pointer, event);
}
if (drag_pointer_ == pointer)
« no previous file with comments | « ash/shelf/shelf_view.h ('k') | ash/shelf/shelf_view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698