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

Side by Side Diff: ui/base/gestures/gesture_point.h

Issue 16018006: Generate tap gesture with tap_count = 3 for triple-tap (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 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 unified diff | Download patch
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 #ifndef UI_BASE_GESTURES_GESTURE_POINT_H_ 5 #ifndef UI_BASE_GESTURES_GESTURE_POINT_H_
6 #define UI_BASE_GESTURES_GESTURE_POINT_H_ 6 #define UI_BASE_GESTURES_GESTURE_POINT_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "ui/base/gestures/velocity_calculator.h" 9 #include "ui/base/gestures/velocity_calculator.h"
10 #include "ui/gfx/point.h" 10 #include "ui/gfx/point.h"
(...skipping 21 matching lines...) Expand all
32 // point. 32 // point.
33 void UpdateForScroll(); 33 void UpdateForScroll();
34 34
35 // Updates states depending on the event and the gesture-state. 35 // Updates states depending on the event and the gesture-state.
36 void UpdateValues(const TouchEvent& event); 36 void UpdateValues(const TouchEvent& event);
37 37
38 // Responds according to the state of the gesture point (i.e. the point can 38 // Responds according to the state of the gesture point (i.e. the point can
39 // represent a click or scroll etc.) 39 // represent a click or scroll etc.)
40 bool IsInClickWindow(const TouchEvent& event) const; 40 bool IsInClickWindow(const TouchEvent& event) const;
41 bool IsInDoubleClickWindow(const TouchEvent& event) const; 41 bool IsInDoubleClickWindow(const TouchEvent& event) const;
42 bool IsInTripleClickWindow(const TouchEvent& event) const;
42 bool IsInScrollWindow(const TouchEvent& event) const; 43 bool IsInScrollWindow(const TouchEvent& event) const;
43 bool IsInFlickWindow(const TouchEvent& event); 44 bool IsInFlickWindow(const TouchEvent& event);
44 bool IsInHorizontalRailWindow() const; 45 bool IsInHorizontalRailWindow() const;
45 bool IsInVerticalRailWindow() const; 46 bool IsInVerticalRailWindow() const;
46 bool IsInsideManhattanSquare(const TouchEvent& event) const; 47 bool IsInsideManhattanSquare(const TouchEvent& event) const;
47 bool BreaksHorizontalRail(); 48 bool BreaksHorizontalRail();
48 bool BreaksVerticalRail(); 49 bool BreaksVerticalRail();
49 bool DidScroll(const TouchEvent& event, int distance) const; 50 bool DidScroll(const TouchEvent& event, int distance) const;
50 51
51 const gfx::Point& first_touch_position() const { 52 const gfx::Point& first_touch_position() const {
(...skipping 27 matching lines...) Expand all
79 const gfx::Rect& enclosing_rectangle() const { return enclosing_rect_; } 80 const gfx::Rect& enclosing_rectangle() const { return enclosing_rect_; }
80 81
81 // Tests if the point has a consistent scroll vector across a window of touch 82 // Tests if the point has a consistent scroll vector across a window of touch
82 // move events. 83 // move events.
83 bool IsConsistentScrollingActionUnderway(); 84 bool IsConsistentScrollingActionUnderway();
84 85
85 private: 86 private:
86 // Various statistical functions to manipulate gestures. 87 // Various statistical functions to manipulate gestures.
87 bool IsInClickTimeWindow() const; 88 bool IsInClickTimeWindow() const;
88 bool IsInSecondClickTimeWindow() const; 89 bool IsInSecondClickTimeWindow() const;
90 bool IsInThirdClickTimeWindow() const;
89 bool IsSecondClickInsideManhattanSquare(const TouchEvent& event) const; 91 bool IsSecondClickInsideManhattanSquare(const TouchEvent& event) const;
92 bool IsThirdClickInsideManhattanSquare(const TouchEvent& event) const;
90 bool IsOverMinFlickSpeed(); 93 bool IsOverMinFlickSpeed();
91 94
92 // Returns -1, 0, 1 for |v| below the negative velocity threshold, 95 // Returns -1, 0, 1 for |v| below the negative velocity threshold,
93 // in [-threshold, threshold] or above respectively. 96 // in [-threshold, threshold] or above respectively.
94 int ScrollVelocityDirection(float v); 97 int ScrollVelocityDirection(float v);
95 98
96 // The enclosing rectangle represents a rectangular touch region generated 99 // The enclosing rectangle represents a rectangular touch region generated
97 // by a sequence of ET_TOUCH_PRESSED, ET_TOUCH_MOVED, and ET_TOUCH_RELEASED 100 // by a sequence of ET_TOUCH_PRESSED, ET_TOUCH_MOVED, and ET_TOUCH_RELEASED
98 // events forming a GESTURE_TAP event. The enclosing rectangle is updated 101 // events forming a GESTURE_TAP event. The enclosing rectangle is updated
99 // to be the union of the touch data from each of these events. It is 102 // to be the union of the touch data from each of these events. It is
100 // cleared on a ET_TOUCH_PRESSED event (i.e., at the beginning of a possible 103 // cleared on a ET_TOUCH_PRESSED event (i.e., at the beginning of a possible
101 // GESTURE_TAP event) or when Reset is called. 104 // GESTURE_TAP event) or when Reset is called.
102 void UpdateEnclosingRectangle(const TouchEvent& event); 105 void UpdateEnclosingRectangle(const TouchEvent& event);
103 void clear_enclosing_rectangle() { enclosing_rect_ = gfx::Rect(); } 106 void clear_enclosing_rectangle() { enclosing_rect_ = gfx::Rect(); }
104 107
105 // The position of the first touchdown event. 108 // The position of the first touchdown event.
106 gfx::Point first_touch_position_; 109 gfx::Point first_touch_position_;
107 double first_touch_time_; 110 double first_touch_time_;
108 111
109 gfx::Point second_last_touch_position_; 112 gfx::Point second_last_touch_position_;
110 double second_last_touch_time_; 113 double second_last_touch_time_;
111 114
112 gfx::Point last_touch_position_; 115 gfx::Point last_touch_position_;
113 double last_touch_time_; 116 double last_touch_time_;
114 117
118 double second_last_tap_time_;
119 gfx::Point second_last_tap_position_;
120
115 double last_tap_time_; 121 double last_tap_time_;
116 gfx::Point last_tap_position_; 122 gfx::Point last_tap_position_;
117 123
118 VelocityCalculator velocity_calculator_; 124 VelocityCalculator velocity_calculator_;
119 125
120 int point_id_; 126 int point_id_;
121 int touch_id_; 127 int touch_id_;
122 128
123 // Represents the rectangle that encloses the circles/ellipses 129 // Represents the rectangle that encloses the circles/ellipses
124 // generated by a sequence of touch events 130 // generated by a sequence of touch events
125 gfx::Rect enclosing_rect_; 131 gfx::Rect enclosing_rect_;
126 132
127 // Count of the number of events with same direction. 133 // Count of the number of events with same direction.
128 gfx::Vector2d same_direction_count_; 134 gfx::Vector2d same_direction_count_;
129 135
130 DISALLOW_COPY_AND_ASSIGN(GesturePoint); 136 DISALLOW_COPY_AND_ASSIGN(GesturePoint);
131 }; 137 };
132 138
133 } // namespace ui 139 } // namespace ui
134 140
135 #endif // UI_BASE_GESTURES_GESTURE_POINT_H_ 141 #endif // UI_BASE_GESTURES_GESTURE_POINT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698