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

Side by Side Diff: ui/base/gestures/gesture_sequence.cc

Issue 10837329: gesture: Include velocity in scroll-update gestures. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/base/gestures/gesture_sequence.h ('k') | ui/base/gestures/gesture_types.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 266
267 unsigned int ComputeTouchBitmask(const GesturePoint* points) { 267 unsigned int ComputeTouchBitmask(const GesturePoint* points) {
268 unsigned int touch_bitmask = 0; 268 unsigned int touch_bitmask = 0;
269 for (int i = 0; i < GestureSequence::kMaxGesturePoints; ++i) { 269 for (int i = 0; i < GestureSequence::kMaxGesturePoints; ++i) {
270 if (points[i].in_use()) 270 if (points[i].in_use())
271 touch_bitmask |= 1 << points[i].touch_id(); 271 touch_bitmask |= 1 << points[i].touch_id();
272 } 272 }
273 return touch_bitmask; 273 return touch_bitmask;
274 } 274 }
275 275
276 float CalibrateFlingVelocity(float velocity) {
277 // TODO(sad|rjkroege): fling-curve is currently configured to work well with
278 // touchpad scroll-events. This curve needs to be adjusted to work correctly
279 // with both touchpad and touchscreen. Until then, scale quadratically.
280 // http://crbug.com/120154
281 const float velocity_scaling = 1.f / 900.f;
282 return velocity_scaling * velocity * fabsf(velocity);
283 }
284
276 } // namespace 285 } // namespace
277 286
278 //////////////////////////////////////////////////////////////////////////////// 287 ////////////////////////////////////////////////////////////////////////////////
279 // GestureSequence Public: 288 // GestureSequence Public:
280 289
281 GestureSequence::GestureSequence(GestureEventHelper* helper) 290 GestureSequence::GestureSequence(GestureEventHelper* helper)
282 : state_(GS_NO_GESTURE), 291 : state_(GS_NO_GESTURE),
283 flags_(0), 292 flags_(0),
284 pinch_distance_start_(0.f), 293 pinch_distance_start_(0.f),
285 pinch_distance_current_(0.f), 294 pinch_distance_current_(0.f),
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 float y_velocity) { 657 float y_velocity) {
649 float railed_x_velocity = x_velocity; 658 float railed_x_velocity = x_velocity;
650 float railed_y_velocity = y_velocity; 659 float railed_y_velocity = y_velocity;
651 660
652 if (scroll_type_ == ST_HORIZONTAL) 661 if (scroll_type_ == ST_HORIZONTAL)
653 railed_y_velocity = 0; 662 railed_y_velocity = 0;
654 else if (scroll_type_ == ST_VERTICAL) 663 else if (scroll_type_ == ST_VERTICAL)
655 railed_x_velocity = 0; 664 railed_x_velocity = 0;
656 665
657 if (railed_x_velocity != 0 || railed_y_velocity != 0) { 666 if (railed_x_velocity != 0 || railed_y_velocity != 0) {
658 // TODO(sad|rjkroege): fling-curve is currently configured to work well with
659 // touchpad scroll-events. This curve needs to be adjusted to work correctly
660 // with both touchpad and touchscreen. Until then, scale quadratically.
661 // http://crbug.com/120154
662 const float velocity_scaling = 1.f / 900.f;
663 667
664 gestures->push_back(CreateGestureEvent( 668 gestures->push_back(CreateGestureEvent(
665 GestureEventDetails(ui::ET_SCROLL_FLING_START, 669 GestureEventDetails(ui::ET_SCROLL_FLING_START,
666 velocity_scaling * railed_x_velocity * fabsf(railed_x_velocity), 670 CalibrateFlingVelocity(railed_x_velocity),
667 velocity_scaling * railed_y_velocity * fabsf(railed_y_velocity)), 671 CalibrateFlingVelocity(railed_y_velocity)),
668 location, 672 location,
669 flags_, 673 flags_,
670 base::Time::FromDoubleT(point.last_touch_time()), 674 base::Time::FromDoubleT(point.last_touch_time()),
671 1 << point.touch_id())); 675 1 << point.touch_id()));
672 } else { 676 } else {
673 gestures->push_back(CreateGestureEvent( 677 gestures->push_back(CreateGestureEvent(
674 GestureEventDetails(ui::ET_GESTURE_SCROLL_END, 0, 0), 678 GestureEventDetails(ui::ET_GESTURE_SCROLL_END, 0, 0),
675 location, 679 location,
676 flags_, 680 flags_,
677 base::Time::FromDoubleT(point.last_touch_time()), 681 base::Time::FromDoubleT(point.last_touch_time()),
678 1 << point.touch_id())); 682 1 << point.touch_id()));
679 } 683 }
680 } 684 }
681 685
682 void GestureSequence::AppendScrollGestureUpdate(const GesturePoint& point, 686 void GestureSequence::AppendScrollGestureUpdate(GesturePoint& point,
683 const gfx::Point& location, 687 const gfx::Point& location,
684 Gestures* gestures) { 688 Gestures* gestures) {
685 gfx::Point current_center = bounding_box_.CenterPoint(); 689 gfx::Point current_center = bounding_box_.CenterPoint();
686 int dx = current_center.x() - bounding_box_last_center_.x(); 690 int dx = current_center.x() - bounding_box_last_center_.x();
687 int dy = current_center.y() - bounding_box_last_center_.y(); 691 int dy = current_center.y() - bounding_box_last_center_.y();
688 if (scroll_type_ == ST_HORIZONTAL) 692 if (scroll_type_ == ST_HORIZONTAL)
689 dy = 0; 693 dy = 0;
690 else if (scroll_type_ == ST_VERTICAL) 694 else if (scroll_type_ == ST_VERTICAL)
691 dx = 0; 695 dx = 0;
692 if (dx == 0 && dy == 0) 696 if (dx == 0 && dy == 0)
693 return; 697 return;
694 698
699 GestureEventDetails details(ui::ET_GESTURE_SCROLL_UPDATE, dx, dy);
700 details.SetScrollVelocity(
701 scroll_type_ == ST_VERTICAL ? 0 : point.XVelocity(),
702 scroll_type_ == ST_HORIZONTAL ? 0 : point.YVelocity());
695 gestures->push_back(CreateGestureEvent( 703 gestures->push_back(CreateGestureEvent(
696 GestureEventDetails(ui::ET_GESTURE_SCROLL_UPDATE, dx, dy), 704 details,
697 location, 705 location,
698 flags_, 706 flags_,
699 base::Time::FromDoubleT(point.last_touch_time()), 707 base::Time::FromDoubleT(point.last_touch_time()),
700 ComputeTouchBitmask(points_))); 708 ComputeTouchBitmask(points_)));
701 } 709 }
702 710
703 void GestureSequence::AppendPinchGestureBegin(const GesturePoint& p1, 711 void GestureSequence::AppendPinchGestureBegin(const GesturePoint& p1,
704 const GesturePoint& p2, 712 const GesturePoint& p2,
705 Gestures* gestures) { 713 Gestures* gestures) {
706 gfx::Point center = bounding_box_.CenterPoint(); 714 gfx::Point center = bounding_box_.CenterPoint();
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
754 const GesturePoint* point = GetPointByPointId(0); 762 const GesturePoint* point = GetPointByPointId(0);
755 gestures->push_back(CreateGestureEvent( 763 gestures->push_back(CreateGestureEvent(
756 GestureEventDetails(ui::ET_GESTURE_TWO_FINGER_TAP, 0, 0), 764 GestureEventDetails(ui::ET_GESTURE_TWO_FINGER_TAP, 0, 0),
757 point->enclosing_rectangle().CenterPoint(), 765 point->enclosing_rectangle().CenterPoint(),
758 flags_, 766 flags_,
759 base::Time::FromDoubleT(point->last_touch_time()), 767 base::Time::FromDoubleT(point->last_touch_time()),
760 1 << point->touch_id())); 768 1 << point->touch_id()));
761 } 769 }
762 770
763 bool GestureSequence::Click(const TouchEvent& event, 771 bool GestureSequence::Click(const TouchEvent& event,
764 const GesturePoint& point, Gestures* gestures) { 772 const GesturePoint& point,
773 Gestures* gestures) {
765 DCHECK(state_ == GS_PENDING_SYNTHETIC_CLICK); 774 DCHECK(state_ == GS_PENDING_SYNTHETIC_CLICK);
766 if (point.IsInClickWindow(event)) { 775 if (point.IsInClickWindow(event)) {
767 bool double_tap = point.IsInDoubleClickWindow(event); 776 bool double_tap = point.IsInDoubleClickWindow(event);
768 AppendClickGestureEvent(point, double_tap ? 2 : 1, gestures); 777 AppendClickGestureEvent(point, double_tap ? 2 : 1, gestures);
769 if (double_tap) 778 if (double_tap)
770 AppendDoubleClickGestureEvent(point, gestures); 779 AppendDoubleClickGestureEvent(point, gestures);
771 return true; 780 return true;
772 } 781 }
773 return false; 782 return false;
774 } 783 }
775 784
776 bool GestureSequence::ScrollStart(const TouchEvent& event, 785 bool GestureSequence::ScrollStart(const TouchEvent& event,
777 GesturePoint& point, Gestures* gestures) { 786 GesturePoint& point,
787 Gestures* gestures) {
778 DCHECK(state_ == GS_PENDING_SYNTHETIC_CLICK); 788 DCHECK(state_ == GS_PENDING_SYNTHETIC_CLICK);
779 if (point.IsInClickWindow(event) || 789 if (point.IsInClickWindow(event) ||
780 !point.IsInScrollWindow(event) || 790 !point.IsInScrollWindow(event) ||
781 !point.HasEnoughDataToEstablishRail()) 791 !point.HasEnoughDataToEstablishRail())
782 return false; 792 return false;
783 AppendScrollGestureBegin(point, point.first_touch_position(), gestures); 793 AppendScrollGestureBegin(point, point.first_touch_position(), gestures);
784 if (point.IsInHorizontalRailWindow()) 794 if (point.IsInHorizontalRailWindow())
785 scroll_type_ = ST_HORIZONTAL; 795 scroll_type_ = ST_HORIZONTAL;
786 else if (point.IsInVerticalRailWindow()) 796 else if (point.IsInVerticalRailWindow())
787 scroll_type_ = ST_VERTICAL; 797 scroll_type_ = ST_VERTICAL;
788 else 798 else
789 scroll_type_ = ST_FREE; 799 scroll_type_ = ST_FREE;
790 return true; 800 return true;
791 } 801 }
792 802
793 void GestureSequence::BreakRailScroll(const TouchEvent& event, 803 void GestureSequence::BreakRailScroll(const TouchEvent& event,
794 GesturePoint& point, Gestures* gestures) { 804 GesturePoint& point,
805 Gestures* gestures) {
795 DCHECK(state_ == GS_SCROLL); 806 DCHECK(state_ == GS_SCROLL);
796 if (scroll_type_ == ST_HORIZONTAL && 807 if (scroll_type_ == ST_HORIZONTAL &&
797 point.BreaksHorizontalRail()) 808 point.BreaksHorizontalRail())
798 scroll_type_ = ST_FREE; 809 scroll_type_ = ST_FREE;
799 else if (scroll_type_ == ST_VERTICAL && 810 else if (scroll_type_ == ST_VERTICAL &&
800 point.BreaksVerticalRail()) 811 point.BreaksVerticalRail())
801 scroll_type_ = ST_FREE; 812 scroll_type_ = ST_FREE;
802 } 813 }
803 814
804 bool GestureSequence::ScrollUpdate(const TouchEvent& event, 815 bool GestureSequence::ScrollUpdate(const TouchEvent& event,
805 const GesturePoint& point, Gestures* gestures) { 816 GesturePoint& point,
817 Gestures* gestures) {
806 DCHECK(state_ == GS_SCROLL); 818 DCHECK(state_ == GS_SCROLL);
807 if (!point.DidScroll(event, 0)) 819 if (!point.DidScroll(event, 0))
808 return false; 820 return false;
809 AppendScrollGestureUpdate(point, point.last_touch_position(), gestures); 821 AppendScrollGestureUpdate(point, point.last_touch_position(), gestures);
810 return true; 822 return true;
811 } 823 }
812 824
813 bool GestureSequence::TouchDown(const TouchEvent& event, 825 bool GestureSequence::TouchDown(const TouchEvent& event,
814 const GesturePoint& point, Gestures* gestures) { 826 const GesturePoint& point,
827 Gestures* gestures) {
815 DCHECK(state_ == GS_NO_GESTURE); 828 DCHECK(state_ == GS_NO_GESTURE);
816 AppendTapDownGestureEvent(point, gestures); 829 AppendTapDownGestureEvent(point, gestures);
817 long_press_timer_->Start( 830 long_press_timer_->Start(
818 FROM_HERE, 831 FROM_HERE,
819 base::TimeDelta::FromMilliseconds( 832 base::TimeDelta::FromMilliseconds(
820 GestureConfiguration::long_press_time_in_seconds() * 1000), 833 GestureConfiguration::long_press_time_in_seconds() * 1000),
821 this, 834 this,
822 &GestureSequence::AppendLongPressGestureEvent); 835 &GestureSequence::AppendLongPressGestureEvent);
823 return true; 836 return true;
824 } 837 }
825 838
826 bool GestureSequence::TwoFingerTouchDown(const TouchEvent& event, 839 bool GestureSequence::TwoFingerTouchDown(const TouchEvent& event,
827 const GesturePoint& point, Gestures* gestures) { 840 const GesturePoint& point,
841 Gestures* gestures) {
828 DCHECK(state_ == GS_PENDING_SYNTHETIC_CLICK || state_ == GS_SCROLL); 842 DCHECK(state_ == GS_PENDING_SYNTHETIC_CLICK || state_ == GS_SCROLL);
829 if (state_ == GS_SCROLL) { 843 if (state_ == GS_SCROLL) {
830 AppendScrollGestureEnd(point, point.last_touch_position(), gestures, 844 AppendScrollGestureEnd(point, point.last_touch_position(), gestures,
831 0.f, 0.f); 845 0.f, 0.f);
832 } 846 }
833 second_touch_time_ = event.time_stamp(); 847 second_touch_time_ = event.time_stamp();
834 return true; 848 return true;
835 } 849 }
836 850
837 bool GestureSequence::TwoFingerTouchMove(const TouchEvent& event, 851 bool GestureSequence::TwoFingerTouchMove(const TouchEvent& event,
838 const GesturePoint& point, Gestures* gestures) { 852 const GesturePoint& point,
853 Gestures* gestures) {
839 DCHECK(state_ == GS_PENDING_TWO_FINGER_TAP); 854 DCHECK(state_ == GS_PENDING_TWO_FINGER_TAP);
840 855
841 base::TimeDelta time_delta = event.time_stamp() - second_touch_time_; 856 base::TimeDelta time_delta = event.time_stamp() - second_touch_time_;
842 base::TimeDelta max_delta = base::TimeDelta::FromMilliseconds(1000 * 857 base::TimeDelta max_delta = base::TimeDelta::FromMilliseconds(1000 *
843 ui::GestureConfiguration::max_touch_down_duration_in_seconds_for_click()); 858 ui::GestureConfiguration::max_touch_down_duration_in_seconds_for_click());
844 if (time_delta > max_delta || !point.IsInsideManhattanSquare(event)) { 859 if (time_delta > max_delta || !point.IsInsideManhattanSquare(event)) {
845 PinchStart(event, point, gestures); 860 PinchStart(event, point, gestures);
846 return true; 861 return true;
847 } 862 }
848 return false; 863 return false;
849 } 864 }
850 865
851 bool GestureSequence::TwoFingerTouchReleased(const TouchEvent& event, 866 bool GestureSequence::TwoFingerTouchReleased(const TouchEvent& event,
852 const GesturePoint& point, Gestures* gestures) { 867 const GesturePoint& point,
868 Gestures* gestures) {
853 DCHECK(state_ == GS_PENDING_TWO_FINGER_TAP); 869 DCHECK(state_ == GS_PENDING_TWO_FINGER_TAP);
854 base::TimeDelta time_delta = event.time_stamp() - second_touch_time_; 870 base::TimeDelta time_delta = event.time_stamp() - second_touch_time_;
855 base::TimeDelta max_delta = base::TimeDelta::FromMilliseconds(1000 * 871 base::TimeDelta max_delta = base::TimeDelta::FromMilliseconds(1000 *
856 ui::GestureConfiguration::max_touch_down_duration_in_seconds_for_click()); 872 ui::GestureConfiguration::max_touch_down_duration_in_seconds_for_click());
857 if (time_delta < max_delta && point.IsInsideManhattanSquare(event)) 873 if (time_delta < max_delta && point.IsInsideManhattanSquare(event))
858 AppendTwoFingerTapGestureEvent(gestures); 874 AppendTwoFingerTapGestureEvent(gestures);
859 return true; 875 return true;
860 } 876 }
861 877
862 void GestureSequence::AppendLongPressGestureEvent() { 878 void GestureSequence::AppendLongPressGestureEvent() {
863 const GesturePoint* point = GetPointByPointId(0); 879 const GesturePoint* point = GetPointByPointId(0);
864 scoped_ptr<GestureEvent> gesture(CreateGestureEvent( 880 scoped_ptr<GestureEvent> gesture(CreateGestureEvent(
865 GestureEventDetails(ui::ET_GESTURE_LONG_PRESS, 0, 0), 881 GestureEventDetails(ui::ET_GESTURE_LONG_PRESS, 0, 0),
866 point->first_touch_position(), 882 point->first_touch_position(),
867 flags_, 883 flags_,
868 base::Time::FromDoubleT(point->last_touch_time()), 884 base::Time::FromDoubleT(point->last_touch_time()),
869 1 << point->touch_id())); 885 1 << point->touch_id()));
870 helper_->DispatchLongPressGestureEvent(gesture.get()); 886 helper_->DispatchLongPressGestureEvent(gesture.get());
871 } 887 }
872 888
873 bool GestureSequence::ScrollEnd(const TouchEvent& event, 889 bool GestureSequence::ScrollEnd(const TouchEvent& event,
874 GesturePoint& point, Gestures* gestures) { 890 GesturePoint& point,
891 Gestures* gestures) {
875 DCHECK(state_ == GS_SCROLL); 892 DCHECK(state_ == GS_SCROLL);
876 if (point.IsInFlickWindow(event)) { 893 if (point.IsInFlickWindow(event)) {
877 AppendScrollGestureEnd(point, point.last_touch_position(), gestures, 894 AppendScrollGestureEnd(point, point.last_touch_position(), gestures,
878 point.XVelocity(), point.YVelocity()); 895 point.XVelocity(), point.YVelocity());
879 } else { 896 } else {
880 AppendScrollGestureEnd(point, point.last_touch_position(), gestures, 897 AppendScrollGestureEnd(point, point.last_touch_position(), gestures,
881 0.f, 0.f); 898 0.f, 0.f);
882 } 899 }
883 return true; 900 return true;
884 } 901 }
885 902
886 bool GestureSequence::PinchStart(const TouchEvent& event, 903 bool GestureSequence::PinchStart(const TouchEvent& event,
887 const GesturePoint& point, Gestures* gestures) { 904 const GesturePoint& point,
905 Gestures* gestures) {
888 DCHECK(state_ == GS_SCROLL || 906 DCHECK(state_ == GS_SCROLL ||
889 state_ == GS_PENDING_SYNTHETIC_CLICK || 907 state_ == GS_PENDING_SYNTHETIC_CLICK ||
890 state_ == GS_PENDING_TWO_FINGER_TAP); 908 state_ == GS_PENDING_TWO_FINGER_TAP);
891 909
892 // Once pinch starts, we immediately break rail scroll. 910 // Once pinch starts, we immediately break rail scroll.
893 scroll_type_ = ST_FREE; 911 scroll_type_ = ST_FREE;
894 912
895 const GesturePoint* point1 = GetPointByPointId(0); 913 const GesturePoint* point1 = GetPointByPointId(0);
896 const GesturePoint* point2 = GetPointByPointId(1); 914 const GesturePoint* point2 = GetPointByPointId(1);
897 915
898 pinch_distance_current_ = BoundingBoxDiagonal(bounding_box_); 916 pinch_distance_current_ = BoundingBoxDiagonal(bounding_box_);
899 pinch_distance_start_ = pinch_distance_current_; 917 pinch_distance_start_ = pinch_distance_current_;
900 AppendPinchGestureBegin(*point1, *point2, gestures); 918 AppendPinchGestureBegin(*point1, *point2, gestures);
901 919
902 if (state_ == GS_PENDING_SYNTHETIC_CLICK || 920 if (state_ == GS_PENDING_SYNTHETIC_CLICK ||
903 state_ == GS_PENDING_TWO_FINGER_TAP) { 921 state_ == GS_PENDING_TWO_FINGER_TAP) {
904 gfx::Point center = bounding_box_.CenterPoint(); 922 gfx::Point center = bounding_box_.CenterPoint();
905 AppendScrollGestureBegin(point, center, gestures); 923 AppendScrollGestureBegin(point, center, gestures);
906 } 924 }
907 925
908 return true; 926 return true;
909 } 927 }
910 928
911 bool GestureSequence::PinchUpdate(const TouchEvent& event, 929 bool GestureSequence::PinchUpdate(const TouchEvent& event,
912 const GesturePoint& point, Gestures* gestures) { 930 GesturePoint& point,
931 Gestures* gestures) {
913 DCHECK(state_ == GS_PINCH); 932 DCHECK(state_ == GS_PINCH);
914 933
915 // It is possible that the none of the touch-points changed their position, 934 // It is possible that the none of the touch-points changed their position,
916 // but their radii changed, and that caused the bounding box to also change. 935 // but their radii changed, and that caused the bounding box to also change.
917 // But in such cases, we do not want to either pinch or scroll. 936 // But in such cases, we do not want to either pinch or scroll.
918 // To avoid small jiggles, it is also necessary to make sure that at least one 937 // To avoid small jiggles, it is also necessary to make sure that at least one
919 // of the fingers moved enough before a pinch or scroll update is created. 938 // of the fingers moved enough before a pinch or scroll update is created.
920 bool did_scroll = false; 939 bool did_scroll = false;
921 for (int i = 0; i < kMaxGesturePoints; ++i) { 940 for (int i = 0; i < kMaxGesturePoints; ++i) {
922 if (!points_[i].in_use() || !points_[i].DidScroll(event, 2)) 941 if (!points_[i].in_use() || !points_[i].DidScroll(event, 2))
(...skipping 14 matching lines...) Expand all
937 pinch_distance_current_ = distance; 956 pinch_distance_current_ = distance;
938 } else { 957 } else {
939 gfx::Point center = bounding_box_.CenterPoint(); 958 gfx::Point center = bounding_box_.CenterPoint();
940 AppendScrollGestureUpdate(point, center, gestures); 959 AppendScrollGestureUpdate(point, center, gestures);
941 } 960 }
942 961
943 return true; 962 return true;
944 } 963 }
945 964
946 bool GestureSequence::PinchEnd(const TouchEvent& event, 965 bool GestureSequence::PinchEnd(const TouchEvent& event,
947 const GesturePoint& point, Gestures* gestures) { 966 const GesturePoint& point,
967 Gestures* gestures) {
948 DCHECK(state_ == GS_PINCH); 968 DCHECK(state_ == GS_PINCH);
949 969
950 GesturePoint* point1 = GetPointByPointId(0); 970 GesturePoint* point1 = GetPointByPointId(0);
951 GesturePoint* point2 = GetPointByPointId(1); 971 GesturePoint* point2 = GetPointByPointId(1);
952 972
953 float distance = BoundingBoxDiagonal(bounding_box_); 973 float distance = BoundingBoxDiagonal(bounding_box_);
954 AppendPinchGestureEnd(*point1, *point2, 974 AppendPinchGestureEnd(*point1, *point2,
955 distance / pinch_distance_start_, gestures); 975 distance / pinch_distance_start_, gestures);
956 976
957 pinch_distance_start_ = 0; 977 pinch_distance_start_ = 0;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
1032 return; 1052 return;
1033 1053
1034 // Since long press timer has been started, there should be a non-NULL point. 1054 // Since long press timer has been started, there should be a non-NULL point.
1035 const GesturePoint* point = GetPointByPointId(0); 1055 const GesturePoint* point = GetPointByPointId(0);
1036 if (!ui::gestures::IsInsideManhattanSquare(point->first_touch_position(), 1056 if (!ui::gestures::IsInsideManhattanSquare(point->first_touch_position(),
1037 event.location())) 1057 event.location()))
1038 long_press_timer_->Stop(); 1058 long_press_timer_->Stop();
1039 } 1059 }
1040 1060
1041 } // namespace ui 1061 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/gestures/gesture_sequence.h ('k') | ui/base/gestures/gesture_types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698