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

Side by Side Diff: third_party/WebKit/public/platform/WebPointerProperties.h

Issue 1617863002: Set the correct pressure for pointer events based on force (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Applying comments Created 4 years, 10 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/web/tests/TouchActionTest.cpp ('k') | ui/events/event.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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;
47
48 // The valid range is [0,1], with NaN meaning pressure is not supported by
49 // the input device.
45 float force; 50 float force;
46 51
47 // Tilt of a pen stylus from surface normal as plane angles in degrees, 52 // 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 53 // Values lie in [-90,90]. A positive tiltX is to the right and a positive
49 // tiltY is towards the user. 54 // tiltY is towards the user.
50 int tiltX; 55 int tiltX;
51 int tiltY; 56 int tiltY;
52 57
53 PointerType pointerType; 58 PointerType pointerType;
54 }; 59 };
55 60
56 } // namespace blink 61 } // namespace blink
57 62
58 #endif 63 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/tests/TouchActionTest.cpp ('k') | ui/events/event.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698