Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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 WebPointerProperties_h | 5 #ifndef WebPointerProperties_h |
| 6 #define WebPointerProperties_h | 6 #define WebPointerProperties_h |
| 7 | 7 |
| 8 #include <cstdint> | 8 #include <cstdint> |
| 9 #include <limits> | 9 #include <limits> |
| 10 | 10 |
| 11 namespace blink { | 11 namespace blink { |
| 12 | 12 |
| 13 // This class encapsulates the properties that are common between mouse and | 13 // This class encapsulates the properties that are common between mouse and |
| 14 // pointer events and touch points as we transition towards the unified pointer | 14 // pointer events and touch points as we transition towards the unified pointer |
| 15 // event model. | 15 // event model. |
| 16 // TODO(e_hakkinen): Replace WebTouchEvent with WebPointerEvent, remove | 16 // TODO(e_hakkinen): Replace WebTouchEvent with WebPointerEvent, remove |
| 17 // WebTouchEvent and WebTouchPoint and merge this into WebPointerEvent. | 17 // WebTouchEvent and WebTouchPoint and merge this into WebPointerEvent. |
| 18 class WebPointerProperties { | 18 class WebPointerProperties { |
| 19 public: | 19 public: |
| 20 WebPointerProperties() | 20 WebPointerProperties() |
| 21 : id(0), | 21 : id(0), |
| 22 force(std::numeric_limits<float>::quiet_NaN()), | 22 force(std::numeric_limits<float>::quiet_NaN()), |
| 23 tiltX(0), | 23 tiltX(0), |
| 24 tiltY(0), | 24 tiltY(0), |
| 25 tangentialPressure(0.0f), | |
| 26 twist(0), | |
| 25 button(Button::NoButton), | 27 button(Button::NoButton), |
| 26 pointerType(PointerType::Unknown) {} | 28 pointerType(PointerType::Unknown) {} |
| 27 | 29 |
| 28 enum class Button { NoButton = -1, Left, Middle, Right, X1, X2, Eraser }; | 30 enum class Button { NoButton = -1, Left, Middle, Right, X1, X2, Eraser }; |
| 29 | 31 |
| 30 enum class Buttons : unsigned { | 32 enum class Buttons : unsigned { |
| 31 NoButton = 0, | 33 NoButton = 0, |
| 32 Left = 1 << 0, | 34 Left = 1 << 0, |
| 33 Right = 1 << 1, | 35 Right = 1 << 1, |
| 34 Middle = 1 << 2, | 36 Middle = 1 << 2, |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 51 // The valid range is [0,1], with NaN meaning pressure is not supported by | 53 // The valid range is [0,1], with NaN meaning pressure is not supported by |
| 52 // the input device. | 54 // the input device. |
| 53 float force; | 55 float force; |
| 54 | 56 |
| 55 // Tilt of a pen stylus from surface normal as plane angles in degrees, | 57 // Tilt of a pen stylus from surface normal as plane angles in degrees, |
| 56 // Values lie in [-90,90]. A positive tiltX is to the right and a positive | 58 // Values lie in [-90,90]. A positive tiltX is to the right and a positive |
| 57 // tiltY is towards the user. | 59 // tiltY is towards the user. |
| 58 int tiltX; | 60 int tiltX; |
| 59 int tiltY; | 61 int tiltY; |
| 60 | 62 |
| 63 // The normalized tangential pressure, typically set by an additional control | |
| 64 // of the stylus, which has a range of [-1,1], where 0 is the neutral | |
| 65 // position of the control. Alwasy 0 if the device does not support it. | |
|
mustaq
2017/01/03 19:09:24
Please also add "(or barrel pressure)" in the firs
lanwei
2017/01/05 16:13:41
Done.
| |
| 66 float tangentialPressure; | |
| 67 | |
| 68 // The clockwise rotation of a pen stylus around its own major axis, in | |
| 69 // degrees of a range of [0,359]). Alwasy 0 if the device does not support | |
|
mustaq
2017/01/03 19:09:24
Nit: "in degrees in the range [0,359]."
lanwei
2017/01/05 16:13:41
Done.
| |
| 70 // it. | |
| 71 int twist; | |
| 72 | |
| 61 Button button; | 73 Button button; |
| 62 PointerType pointerType; | 74 PointerType pointerType; |
| 63 }; | 75 }; |
| 64 | 76 |
| 65 } // namespace blink | 77 } // namespace blink |
| 66 | 78 |
| 67 #endif | 79 #endif |
| OLD | NEW |