Chromium Code Reviews| Index: ash/wm/workspace/frame_maximize_button.cc |
| diff --git a/ash/wm/workspace/frame_maximize_button.cc b/ash/wm/workspace/frame_maximize_button.cc |
| index 23192407314edcb8251dec3ed11e882e841151a9..69fbd1b7c0c59ba4323ef36d39c026e94d43253a 100644 |
| --- a/ash/wm/workspace/frame_maximize_button.cc |
| +++ b/ash/wm/workspace/frame_maximize_button.cc |
| @@ -337,11 +337,9 @@ void FrameMaximizeButton::ProcessStartEvent(const ui::LocatedEvent& event) { |
| void FrameMaximizeButton::ProcessUpdateEvent(const ui::LocatedEvent& event) { |
| DCHECK(is_snap_enabled_); |
| - int delta_x = event.x() - press_location_.x(); |
| - int delta_y = event.y() - press_location_.y(); |
| if (!exceeded_drag_threshold_) { |
| - exceeded_drag_threshold_ = |
| - views::View::ExceededDragThreshold(delta_x, delta_y); |
| + exceeded_drag_threshold_ = views::View::ExceededDragThreshold( |
| + event.location() - press_location_); |
| } |
| if (exceeded_drag_threshold_) |
| UpdateSnap(event.location(), false); |
| @@ -449,15 +447,14 @@ void FrameMaximizeButton::UpdateSnap(const gfx::Point& location, |
| SnapType FrameMaximizeButton::SnapTypeForLocation( |
| const gfx::Point& location) const { |
| MaximizeBubbleFrameState maximize_type = GetMaximizeBubbleFrameState(); |
| - int delta_x = location.x() - press_location_.x(); |
| - int delta_y = location.y() - press_location_.y(); |
| - if (!views::View::ExceededDragThreshold(delta_x, delta_y)) |
| + gfx::Vector2d delta(location - press_location_); |
| + if (!views::View::ExceededDragThreshold(delta)) |
| return maximize_type != FRAME_STATE_FULL ? SNAP_MAXIMIZE : SNAP_RESTORE; |
| - else if (delta_x < 0 && delta_y > delta_x && delta_y < -delta_x) |
| + else if (delta.x() < 0 && delta.y() > delta.x() && delta.y() < -delta.x()) |
|
Peter Kasting
2012/10/31 01:04:41
Nit: While here, remove "else"s (no else after ret
danakj
2012/10/31 16:55:46
Done.
|
| return maximize_type == FRAME_STATE_SNAP_LEFT ? SNAP_RESTORE : SNAP_LEFT; |
| - else if (delta_x > 0 && delta_y > -delta_x && delta_y < delta_x) |
| + else if (delta.x() > 0 && delta.y() > -delta.x() && delta.y() < delta.x()) |
| return maximize_type == FRAME_STATE_SNAP_RIGHT ? SNAP_RESTORE : SNAP_RIGHT; |
| - else if (delta_y > 0) |
| + else if (delta.y() > 0) |
| return SNAP_MINIMIZE; |
| return maximize_type != FRAME_STATE_FULL ? SNAP_MAXIMIZE : SNAP_RESTORE; |
| } |