OLD | NEW |
---|---|
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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
55 virtual size_t GetPointerCount() const = 0; | 55 virtual size_t GetPointerCount() const = 0; |
56 virtual int GetPointerId(size_t pointer_index) const = 0; | 56 virtual int GetPointerId(size_t pointer_index) const = 0; |
57 virtual float GetX(size_t pointer_index) const = 0; | 57 virtual float GetX(size_t pointer_index) const = 0; |
58 virtual float GetY(size_t pointer_index) const = 0; | 58 virtual float GetY(size_t pointer_index) const = 0; |
59 virtual float GetRawX(size_t pointer_index) const = 0; | 59 virtual float GetRawX(size_t pointer_index) const = 0; |
60 virtual float GetRawY(size_t pointer_index) const = 0; | 60 virtual float GetRawY(size_t pointer_index) const = 0; |
61 virtual float GetTouchMajor(size_t pointer_index) const = 0; | 61 virtual float GetTouchMajor(size_t pointer_index) const = 0; |
62 virtual float GetTouchMinor(size_t pointer_index) const = 0; | 62 virtual float GetTouchMinor(size_t pointer_index) const = 0; |
63 virtual float GetOrientation(size_t pointer_index) const = 0; | 63 virtual float GetOrientation(size_t pointer_index) const = 0; |
64 virtual float GetPressure(size_t pointer_index) const = 0; | 64 virtual float GetPressure(size_t pointer_index) const = 0; |
65 // TODO(e_hakkinen): Remove either GetTilt and GetTiltOrientation or GetTiltX | |
66 // and GetTiltY. | |
67 virtual float GetTilt(size_t pointer_index) const = 0; | |
mustaq
2015/06/17 20:01:27
Since the discussion in crrev.com/1147083005 showe
USE eero AT chromium.org
2015/06/18 11:34:07
Done.
Initially I thought that WebTouchPoint to M
| |
68 virtual float GetTiltOrientation(size_t pointer_index) const = 0; | |
69 virtual float GetTiltX(size_t pointer_index) const = 0; | |
70 virtual float GetTiltY(size_t pointer_index) const = 0; | |
65 virtual ToolType GetToolType(size_t pointer_index) const = 0; | 71 virtual ToolType GetToolType(size_t pointer_index) const = 0; |
66 virtual int GetButtonState() const = 0; | 72 virtual int GetButtonState() const = 0; |
67 virtual int GetFlags() const = 0; | 73 virtual int GetFlags() const = 0; |
68 virtual base::TimeTicks GetEventTime() const = 0; | 74 virtual base::TimeTicks GetEventTime() const = 0; |
69 | 75 |
70 // Optional historical data, default implementation provides an empty history. | 76 // Optional historical data, default implementation provides an empty history. |
71 virtual size_t GetHistorySize() const; | 77 virtual size_t GetHistorySize() const; |
72 virtual base::TimeTicks GetHistoricalEventTime(size_t historical_index) const; | 78 virtual base::TimeTicks GetHistoricalEventTime(size_t historical_index) const; |
73 virtual float GetHistoricalTouchMajor(size_t pointer_index, | 79 virtual float GetHistoricalTouchMajor(size_t pointer_index, |
74 size_t historical_index) const; | 80 size_t historical_index) const; |
(...skipping 18 matching lines...) Expand all Loading... | |
93 float GetTouchMinor() const { return GetTouchMinor(0); } | 99 float GetTouchMinor() const { return GetTouchMinor(0); } |
94 | 100 |
95 // Returns the orientation in radians. The meaning is overloaded: | 101 // Returns the orientation in radians. The meaning is overloaded: |
96 // * For a touch screen or pad, it's the orientation of the major axis | 102 // * For a touch screen or pad, it's the orientation of the major axis |
97 // clockwise from vertical. The return value lies in [-PI/2, PI/2]. | 103 // clockwise from vertical. The return value lies in [-PI/2, PI/2]. |
98 // * For a stylus, it indicates the direction in which the stylus is pointing. | 104 // * For a stylus, it indicates the direction in which the stylus is pointing. |
99 // The return value lies in [-PI, PI]. | 105 // The return value lies in [-PI, PI]. |
100 float GetOrientation() const { return GetOrientation(0); } | 106 float GetOrientation() const { return GetOrientation(0); } |
101 | 107 |
102 float GetPressure() const { return GetPressure(0); } | 108 float GetPressure() const { return GetPressure(0); } |
109 | |
110 // TODO(e_hakkinen): Remove either GetTilt and GetTiltOrientation or GetTiltX | |
111 // and GetTiltY. | |
112 float GetTilt() const { return GetTilt(0); } | |
113 float GetTiltOrientation() const { return GetTiltOrientation(0); } | |
114 float GetTiltY() const { return GetTiltX(0); } | |
115 float GetTiltX() const { return GetTiltY(0); } | |
116 | |
103 ToolType GetToolType() const { return GetToolType(0); } | 117 ToolType GetToolType() const { return GetToolType(0); } |
104 | 118 |
105 // O(N) search of pointers (use sparingly!). Returns -1 if |id| nonexistent. | 119 // O(N) search of pointers (use sparingly!). Returns -1 if |id| nonexistent. |
106 int FindPointerIndexOfId(int id) const; | 120 int FindPointerIndexOfId(int id) const; |
107 | 121 |
108 // Note that these methods perform shallow copies of the originating events. | 122 // Note that these methods perform shallow copies of the originating events. |
109 // They guarantee only that the returned type will reflect the same | 123 // They guarantee only that the returned type will reflect the same |
110 // data exposed by the MotionEvent interface; no guarantees are made that the | 124 // data exposed by the MotionEvent interface; no guarantees are made that the |
111 // underlying implementation is identical to the source implementation. | 125 // underlying implementation is identical to the source implementation. |
112 scoped_ptr<MotionEvent> Clone() const; | 126 scoped_ptr<MotionEvent> Clone() const; |
113 scoped_ptr<MotionEvent> Cancel() const; | 127 scoped_ptr<MotionEvent> Cancel() const; |
114 }; | 128 }; |
115 | 129 |
116 } // namespace ui | 130 } // namespace ui |
117 | 131 |
118 #endif // UI_EVENTS_GESTURE_DETECTION_MOTION_EVENT_H_ | 132 #endif // UI_EVENTS_GESTURE_DETECTION_MOTION_EVENT_H_ |
OLD | NEW |