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

Unified Diff: ui/events/gesture_detection/motion_event.h

Issue 2860793003: Pass through tilt_x and tilt_y to blink (Closed)
Patch Set: Pass through tilt_x and tilt_y to blink Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/events/blink/blink_event_util.cc ('k') | ui/events/gesture_detection/motion_event_buffer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/gesture_detection/motion_event.h
diff --git a/ui/events/gesture_detection/motion_event.h b/ui/events/gesture_detection/motion_event.h
index f38cb96c1a290775a541bb9ccebaa6b1a8669f9b..05a3c55ee0f0b3ec8921682fc51cec6254e90e5a 100644
--- a/ui/events/gesture_detection/motion_event.h
+++ b/ui/events/gesture_detection/motion_event.h
@@ -76,7 +76,8 @@ class GESTURE_DETECTION_EXPORT MotionEvent {
virtual float GetTouchMinor(size_t pointer_index) const = 0;
virtual float GetOrientation(size_t pointer_index) const = 0;
virtual float GetPressure(size_t pointer_index) const = 0;
- virtual float GetTilt(size_t pointer_index) const = 0;
+ virtual float GetTiltX(size_t pointer_index) const = 0;
+ virtual float GetTiltY(size_t pointer_index) const = 0;
virtual ToolType GetToolType(size_t pointer_index) const = 0;
virtual int GetButtonState() const = 0;
virtual int GetFlags() const = 0;
@@ -112,10 +113,19 @@ class GESTURE_DETECTION_EXPORT MotionEvent {
// clockwise from vertical. The return value lies in [-PI/2, PI/2].
// * For a stylus, it indicates the direction in which the stylus is pointing.
// The return value lies in [-PI, PI].
+ // Stylus 3D orientation is returned in GetTiltX/Y. TODO(jkwang):
+ // Cleanup the stylus comment & usage here.
float GetOrientation() const { return GetOrientation(0); }
float GetPressure() const { return GetPressure(0); }
- float GetTilt() const { return GetTilt(0); }
+ // We have GetTiltX/Y here instead of GetTilt because MotionEvent spec is not
+ // expressive enough for both 2D touch-surface geometry and 3D pen-orientation
+ // geometry, as needed for PointerEvents:
+ // https://w3c.github.io/pointerevents
+ // Both GetTiltX and GetTiltY return angles in **degrees**, in the range
+ // [-90,90]. See the PointerEvent spec link above for details
+ float GetTiltX() const { return GetTiltX(0); }
+ float GetTiltY() const { return GetTiltY(0); }
ToolType GetToolType() const { return GetToolType(0); }
// O(N) search of pointers (use sparingly!). Returns -1 if |id| nonexistent.
« no previous file with comments | « ui/events/blink/blink_event_util.cc ('k') | ui/events/gesture_detection/motion_event_buffer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698