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

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

Issue 9566020: Revert 124071 - Gestures are now possible using touch events with any ids (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 9 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 <cmath> 7 #include <cmath>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "ui/aura/event.h" 10 #include "ui/aura/event.h"
11 #include "ui/aura/gestures/gesture_configuration.h" 11 #include "ui/aura/gestures/gesture_configuration.h"
12 #include "ui/base/events.h" 12 #include "ui/base/events.h"
13 13
14 namespace { 14 namespace {
15 15
16 const int kMinRailBreakVelocity = 200; 16 const int kMinRailBreakVelocity = 200;
17 const int kMinScrollDeltaSquared = 5 * 5; 17 const int kMinScrollDeltaSquared = 5 * 5;
18 const int kRailBreakProportion = 15; 18 const int kRailBreakProportion = 15;
19 const int kRailStartProportion = 2; 19 const int kRailStartProportion = 2;
20 const int kBufferedPoints = 10; 20 const int kBufferedPoints = 10;
21 21
22 } // namespace 22 } // namespace
23 23
24 namespace aura { 24 namespace aura {
25 25
26 GesturePoint::GesturePoint() 26 GesturePoint::GesturePoint()
27 : first_touch_time_(0.0), 27 : first_touch_time_(0.0),
28 last_touch_time_(0.0), 28 last_touch_time_(0.0),
29 last_tap_time_(0.0), 29 last_tap_time_(0.0),
30 velocity_calculator_(kBufferedPoints), 30 velocity_calculator_(kBufferedPoints) {
31 point_id_(-1) {
32 } 31 }
33 32
34 GesturePoint::~GesturePoint() {} 33 GesturePoint::~GesturePoint() {}
35 34
36 void GesturePoint::Reset() { 35 void GesturePoint::Reset() {
37 first_touch_time_ = last_touch_time_ = 0.0; 36 first_touch_time_ = last_touch_time_ = 0.0;
38 velocity_calculator_.ClearHistory(); 37 velocity_calculator_.ClearHistory();
39 point_id_ = -1;
40 } 38 }
41 39
42 void GesturePoint::UpdateValues(const TouchEvent& event) { 40 void GesturePoint::UpdateValues(const TouchEvent& event) {
43 const int64 event_timestamp_microseconds = 41 const int64 event_timestamp_microseconds =
44 event.time_stamp().InMicroseconds(); 42 event.time_stamp().InMicroseconds();
45 if (event.type() == ui::ET_TOUCH_MOVED) { 43 if (event.type() == ui::ET_TOUCH_MOVED) {
46 velocity_calculator_.PointSeen(event.x(), 44 velocity_calculator_.PointSeen(event.x(),
47 event.y(), 45 event.y(),
48 event_timestamp_microseconds); 46 event_timestamp_microseconds);
49 } 47 }
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 return manhattanDistance < 162 return manhattanDistance <
165 GestureConfiguration::max_touch_move_in_pixels_for_click(); 163 GestureConfiguration::max_touch_move_in_pixels_for_click();
166 } 164 }
167 165
168 bool GesturePoint::IsOverMinFlickSpeed() { 166 bool GesturePoint::IsOverMinFlickSpeed() {
169 return velocity_calculator_.VelocitySquared() > 167 return velocity_calculator_.VelocitySquared() >
170 GestureConfiguration::min_flick_speed_squared(); 168 GestureConfiguration::min_flick_speed_squared();
171 } 169 }
172 170
173 } // namespace aura 171 } // 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