| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/base/gestures/gesture_sequence.h" | 5 #include "ui/base/gestures/gesture_sequence.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 664 location, | 664 location, |
| 665 flags_, | 665 flags_, |
| 666 base::Time::FromDoubleT(point.last_touch_time()), | 666 base::Time::FromDoubleT(point.last_touch_time()), |
| 667 1 << point.touch_id())); | 667 1 << point.touch_id())); |
| 668 } | 668 } |
| 669 } | 669 } |
| 670 | 670 |
| 671 void GestureSequence::AppendScrollGestureUpdate(const GesturePoint& point, | 671 void GestureSequence::AppendScrollGestureUpdate(const GesturePoint& point, |
| 672 const gfx::Point& location, | 672 const gfx::Point& location, |
| 673 Gestures* gestures) { | 673 Gestures* gestures) { |
| 674 int dx = location.x() - bounding_box_last_center_.x(); | 674 gfx::Point current_center = bounding_box_.CenterPoint(); |
| 675 int dy = location.y() - bounding_box_last_center_.y(); | 675 int dx = current_center.x() - bounding_box_last_center_.x(); |
| 676 int dy = current_center.y() - bounding_box_last_center_.y(); |
| 676 if (dx == 0 && dy == 0) | 677 if (dx == 0 && dy == 0) |
| 677 return; | 678 return; |
| 678 if (scroll_type_ == ST_HORIZONTAL) | 679 if (scroll_type_ == ST_HORIZONTAL) |
| 679 dy = 0; | 680 dy = 0; |
| 680 else if (scroll_type_ == ST_VERTICAL) | 681 else if (scroll_type_ == ST_VERTICAL) |
| 681 dx = 0; | 682 dx = 0; |
| 682 | 683 |
| 683 gestures->push_back(CreateGestureEvent( | 684 gestures->push_back(CreateGestureEvent( |
| 684 GestureEventDetails(ui::ET_GESTURE_SCROLL_UPDATE, dx, dy), | 685 GestureEventDetails(ui::ET_GESTURE_SCROLL_UPDATE, dx, dy), |
| 685 location, | 686 location, |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1009 return; | 1010 return; |
| 1010 | 1011 |
| 1011 // Since long press timer has been started, there should be a non-NULL point. | 1012 // Since long press timer has been started, there should be a non-NULL point. |
| 1012 const GesturePoint* point = GetPointByPointId(0); | 1013 const GesturePoint* point = GetPointByPointId(0); |
| 1013 if (!ui::gestures::IsInsideManhattanSquare(point->first_touch_position(), | 1014 if (!ui::gestures::IsInsideManhattanSquare(point->first_touch_position(), |
| 1014 event.GetLocation())) | 1015 event.GetLocation())) |
| 1015 long_press_timer_->Stop(); | 1016 long_press_timer_->Stop(); |
| 1016 } | 1017 } |
| 1017 | 1018 |
| 1018 } // namespace ui | 1019 } // namespace ui |
| OLD | NEW |