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 <limits> | |
| 9 | |
| 8 namespace blink { | 10 namespace blink { |
| 9 | 11 |
| 10 // This class encapsulates the properties that are common between mouse and | 12 // This class encapsulates the properties that are common between mouse and |
| 11 // pointer events and touch points as we transition towards the unified pointer | 13 // pointer events and touch points as we transition towards the unified pointer |
| 12 // event model. | 14 // event model. |
| 13 // TODO(e_hakkinen): Replace WebTouchEvent with WebPointerEvent, remove | 15 // TODO(e_hakkinen): Replace WebTouchEvent with WebPointerEvent, remove |
| 14 // WebTouchEvent and WebTouchPoint and merge this into WebPointerEvent. | 16 // WebTouchEvent and WebTouchPoint and merge this into WebPointerEvent. |
| 15 class WebPointerProperties { | 17 class WebPointerProperties { |
| 16 public: | 18 public: |
| 17 WebPointerProperties() | 19 WebPointerProperties() |
| 18 : button(ButtonNone) | 20 : button(ButtonNone) |
| 19 , id(0) | 21 , id(0) |
| 20 , force(0.f) | 22 , force(std::numeric_limits<float>::quiet_NaN()) |
| 21 , tiltX(0) | 23 , tiltX(0) |
| 22 , tiltY(0) | 24 , tiltY(0) |
| 23 , pointerType(PointerType::Unknown) | 25 , pointerType(PointerType::Unknown) |
| 24 { | 26 { |
| 25 } | 27 } |
| 26 | 28 |
| 27 enum Button { | 29 enum Button { |
| 28 ButtonNone = -1, | 30 ButtonNone = -1, |
| 29 ButtonLeft, | 31 ButtonLeft, |
| 30 ButtonMiddle, | 32 ButtonMiddle, |
| 31 ButtonRight | 33 ButtonRight |
| 32 }; | 34 }; |
| 33 | 35 |
| 34 enum class PointerType : int { | 36 enum class PointerType : int { |
| 35 Unknown, | 37 Unknown, |
| 36 Mouse, | 38 Mouse, |
| 37 Pen, | 39 Pen, |
| 38 Touch, | 40 Touch, |
| 39 LastEntry = Touch // Must be the last entry in the list | 41 LastEntry = Touch // Must be the last entry in the list |
| 40 }; | 42 }; |
| 41 | 43 |
| 42 Button button; | 44 Button button; |
| 43 | 45 |
| 44 int id; | 46 int id; |
| 45 float force; | 47 float force; |
|
Rick Byers
2016/01/25 21:32:22
nit: please add a comment describing the semantics
Navid Zolghadr
2016/01/26 16:29:00
Done.
| |
| 46 | 48 |
| 47 // Tilt of a pen stylus from surface normal as plane angles in degrees, | 49 // Tilt of a pen stylus from surface normal as plane angles in degrees, |
| 48 // Values lie in [-90,90]. A positive tiltX is to the right and a positive | 50 // Values lie in [-90,90]. A positive tiltX is to the right and a positive |
| 49 // tiltY is towards the user. | 51 // tiltY is towards the user. |
| 50 int tiltX; | 52 int tiltX; |
| 51 int tiltY; | 53 int tiltY; |
| 52 | 54 |
| 53 PointerType pointerType; | 55 PointerType pointerType; |
| 54 }; | 56 }; |
| 55 | 57 |
| 56 } // namespace blink | 58 } // namespace blink |
| 57 | 59 |
| 58 #endif | 60 #endif |
| OLD | NEW |