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

Side by Side Diff: ui/events/gesture_detection/motion_event.h

Issue 494833003: Completed webkit radiusX, radiusY and rotationAngle handling. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_EVENTS_GESTURE_DETECTION_MOTION_EVENT_H_ 5 #ifndef UI_EVENTS_GESTURE_DETECTION_MOTION_EVENT_H_
6 #define UI_EVENTS_GESTURE_DETECTION_MOTION_EVENT_H_ 6 #define UI_EVENTS_GESTURE_DETECTION_MOTION_EVENT_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "ui/events/gesture_detection/gesture_detection_export.h" 10 #include "ui/events/gesture_detection/gesture_detection_export.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 // Only valid if |GetAction()| returns ACTION_POINTER_UP or 51 // Only valid if |GetAction()| returns ACTION_POINTER_UP or
52 // ACTION_POINTER_DOWN. 52 // ACTION_POINTER_DOWN.
53 virtual int GetActionIndex() const = 0; 53 virtual int GetActionIndex() const = 0;
54 virtual size_t GetPointerCount() const = 0; 54 virtual size_t GetPointerCount() const = 0;
55 virtual int GetPointerId(size_t pointer_index) const = 0; 55 virtual int GetPointerId(size_t pointer_index) const = 0;
56 virtual float GetX(size_t pointer_index) const = 0; 56 virtual float GetX(size_t pointer_index) const = 0;
57 virtual float GetY(size_t pointer_index) const = 0; 57 virtual float GetY(size_t pointer_index) const = 0;
58 virtual float GetRawX(size_t pointer_index) const = 0; 58 virtual float GetRawX(size_t pointer_index) const = 0;
59 virtual float GetRawY(size_t pointer_index) const = 0; 59 virtual float GetRawY(size_t pointer_index) const = 0;
60 virtual float GetTouchMajor(size_t pointer_index) const = 0; 60 virtual float GetTouchMajor(size_t pointer_index) const = 0;
61 virtual float GetTouchMinor(size_t pointer_index) const = 0;
62 virtual float GetOrientation(size_t pointer_index) const = 0;
61 virtual float GetPressure(size_t pointer_index) const = 0; 63 virtual float GetPressure(size_t pointer_index) const = 0;
62 virtual ToolType GetToolType(size_t pointer_index) const = 0; 64 virtual ToolType GetToolType(size_t pointer_index) const = 0;
63 virtual int GetButtonState() const = 0; 65 virtual int GetButtonState() const = 0;
64 virtual base::TimeTicks GetEventTime() const = 0; 66 virtual base::TimeTicks GetEventTime() const = 0;
65 67
66 // Optional historical data, default implementation provides an empty history. 68 // Optional historical data, default implementation provides an empty history.
67 virtual size_t GetHistorySize() const; 69 virtual size_t GetHistorySize() const;
68 virtual base::TimeTicks GetHistoricalEventTime(size_t historical_index) const; 70 virtual base::TimeTicks GetHistoricalEventTime(size_t historical_index) const;
69 virtual float GetHistoricalTouchMajor(size_t pointer_index, 71 virtual float GetHistoricalTouchMajor(size_t pointer_index,
70 size_t historical_index) const; 72 size_t historical_index) const;
73 virtual float GetHistoricalTouchMinor(size_t pointer_index,
74 size_t historical_index) const;
75 virtual float GetHistoricalOrientation(size_t pointer_index,
76 size_t historical_index) const;
71 virtual float GetHistoricalX(size_t pointer_index, 77 virtual float GetHistoricalX(size_t pointer_index,
72 size_t historical_index) const; 78 size_t historical_index) const;
73 virtual float GetHistoricalY(size_t pointer_index, 79 virtual float GetHistoricalY(size_t pointer_index,
74 size_t historical_index) const; 80 size_t historical_index) const;
75 81
76 virtual scoped_ptr<MotionEvent> Clone() const = 0; 82 virtual scoped_ptr<MotionEvent> Clone() const = 0;
77 virtual scoped_ptr<MotionEvent> Cancel() const = 0; 83 virtual scoped_ptr<MotionEvent> Cancel() const = 0;
78 84
79 // Utility accessor methods for convenience.
80 float GetX() const { return GetX(0); } 85 float GetX() const { return GetX(0); }
81 float GetY() const { return GetY(0); } 86 float GetY() const { return GetY(0); }
82 float GetRawX() const { return GetRawX(0); } 87 float GetRawX() const { return GetRawX(0); }
83 float GetRawY() const { return GetRawY(0); } 88 float GetRawY() const { return GetRawY(0); }
84 float GetRawOffsetX() const { return GetRawX() - GetX(); } 89 float GetRawOffsetX() const { return GetRawX() - GetX(); }
85 float GetRawOffsetY() const { return GetRawY() - GetY(); } 90 float GetRawOffsetY() const { return GetRawY() - GetY(); }
91
86 float GetTouchMajor() const { return GetTouchMajor(0); } 92 float GetTouchMajor() const { return GetTouchMajor(0); }
93 float GetTouchMinor() const { return GetTouchMinor(0); }
94
95 // Returns the orientation of the major axis closkwise from vertical, in
jdduke (slow) 2014/08/28 15:31:57 clockwise
mustaq 2014/08/28 21:56:02 Done.
96 // radians. The return value lies in [-PI/2, PI/2].
97 float GetOrientation() const { return GetOrientation(0); }
98
87 float GetPressure() const { return GetPressure(0); } 99 float GetPressure() const { return GetPressure(0); }
88 ToolType GetToolType() const { return GetToolType(0); } 100 ToolType GetToolType() const { return GetToolType(0); }
89 101
90 // O(N) search of pointers (use sparingly!). Returns -1 if |id| nonexistent. 102 // O(N) search of pointers (use sparingly!). Returns -1 if |id| nonexistent.
91 int FindPointerIndexOfId(int id) const; 103 int FindPointerIndexOfId(int id) const;
92 }; 104 };
93 105
94 GESTURE_DETECTION_EXPORT bool operator==(const MotionEvent& lhs, 106 GESTURE_DETECTION_EXPORT bool operator==(const MotionEvent& lhs,
95 const MotionEvent& rhs); 107 const MotionEvent& rhs);
96 GESTURE_DETECTION_EXPORT bool operator!=(const MotionEvent& lhs, 108 GESTURE_DETECTION_EXPORT bool operator!=(const MotionEvent& lhs,
97 const MotionEvent& rhs); 109 const MotionEvent& rhs);
98 110
99 } // namespace ui 111 } // namespace ui
100 112
101 #endif // UI_EVENTS_GESTURE_DETECTION_MOTION_EVENT_H_ 113 #endif // UI_EVENTS_GESTURE_DETECTION_MOTION_EVENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698