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

Side by Side Diff: ui/aura/gestures/gesture_point.cc

Issue 9318010: Tweak the aura gesture recognizer slightly. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 10 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/aura/gestures/gesture_point.h ('k') | ui/aura/gestures/gesture_recognizer_unittest.cc » ('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/aura/gestures/gesture_point.h" 5 #include "ui/aura/gestures/gesture_point.h"
6 6
7 #include "ui/aura/event.h" 7 #include "ui/aura/event.h"
8 #include "ui/base/events.h" 8 #include "ui/base/events.h"
9 9
10 namespace { 10 namespace {
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 78
79 bool GesturePoint::IsInScrollWindow(const TouchEvent& event) const { 79 bool GesturePoint::IsInScrollWindow(const TouchEvent& event) const {
80 return event.type() == ui::ET_TOUCH_MOVED && 80 return event.type() == ui::ET_TOUCH_MOVED &&
81 !IsInsideManhattanSquare(event); 81 !IsInsideManhattanSquare(event);
82 } 82 }
83 83
84 bool GesturePoint::IsInFlickWindow(const TouchEvent& event) const { 84 bool GesturePoint::IsInFlickWindow(const TouchEvent& event) const {
85 return IsOverMinFlickSpeed() && event.type() != ui::ET_TOUCH_CANCELLED; 85 return IsOverMinFlickSpeed() && event.type() != ui::ET_TOUCH_CANCELLED;
86 } 86 }
87 87
88 bool GesturePoint::DidScroll(const TouchEvent& event) const {
89 return abs(last_touch_position_.x() - first_touch_position_.x()) > 0 ||
90 abs(last_touch_position_.y() - first_touch_position_.y()) > 0;
91 }
92
88 bool GesturePoint::IsInClickTimeWindow() const { 93 bool GesturePoint::IsInClickTimeWindow() const {
89 double duration = last_touch_time_ - first_touch_time_; 94 double duration = last_touch_time_ - first_touch_time_;
90 return duration >= kMinimumTouchDownDurationInSecondsForClick && 95 return duration >= kMinimumTouchDownDurationInSecondsForClick &&
91 duration < kMaximumTouchDownDurationInSecondsForClick; 96 duration < kMaximumTouchDownDurationInSecondsForClick;
92 } 97 }
93 98
94 bool GesturePoint::IsInSecondClickTimeWindow() const { 99 bool GesturePoint::IsInSecondClickTimeWindow() const {
95 double duration = last_touch_time_ - last_tap_time_; 100 double duration = last_touch_time_ - last_tap_time_;
96 return duration < kMaximumSecondsBetweenDoubleClick; 101 return duration < kMaximumSecondsBetweenDoubleClick;
97 } 102 }
(...skipping 10 matching lines...) Expand all
108 abs(event.y() - last_tap_position_.y()); 113 abs(event.y() - last_tap_position_.y());
109 return manhattanDistance < kMaximumTouchMoveInPixelsForClick; 114 return manhattanDistance < kMaximumTouchMoveInPixelsForClick;
110 } 115 }
111 116
112 bool GesturePoint::IsOverMinFlickSpeed() const { 117 bool GesturePoint::IsOverMinFlickSpeed() const {
113 return (x_velocity_ * x_velocity_ + y_velocity_ * y_velocity_) > 118 return (x_velocity_ * x_velocity_ + y_velocity_ * y_velocity_) >
114 kMinFlickSpeedSquared; 119 kMinFlickSpeedSquared;
115 } 120 }
116 121
117 } // namespace aura 122 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/gestures/gesture_point.h ('k') | ui/aura/gestures/gesture_recognizer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698