Chromium Code Reviews| 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..7f850c2bc95d58a725faa811b36afbbf956df12d 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: |
|
sadrul
2017/05/16 19:21:57
Can you assign an owner for the TODO here?
|
| + // 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. |