OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 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 SKY_ENGINE_CORE_EVENTS_GESTUREEVENT_H_ | 5 #ifndef SKY_ENGINE_CORE_EVENTS_GESTUREEVENT_H_ |
6 #define SKY_ENGINE_CORE_EVENTS_GESTUREEVENT_H_ | 6 #define SKY_ENGINE_CORE_EVENTS_GESTUREEVENT_H_ |
7 | 7 |
8 #include "sky/engine/core/events/Event.h" | 8 #include "sky/engine/core/events/Event.h" |
9 #include "sky/engine/public/platform/WebInputEvent.h" | 9 #include "sky/engine/public/platform/WebInputEvent.h" |
10 | 10 |
11 namespace blink { | 11 namespace blink { |
12 | 12 |
13 struct GestureEventInit : public EventInit { | 13 struct GestureEventInit : public EventInit { |
14 int primaryPointer = 0; | |
14 double x = 0; | 15 double x = 0; |
15 double y = 0; | 16 double y = 0; |
16 double dx = 0; | 17 double dx = 0; |
17 double dy = 0; | 18 double dy = 0; |
18 double velocityX = 0; | 19 double velocityX = 0; |
19 double velocityY = 0; | 20 double velocityY = 0; |
20 }; | 21 }; |
21 | 22 |
22 class GestureEvent : public Event { | 23 class GestureEvent : public Event { |
23 DEFINE_WRAPPERTYPEINFO(); | 24 DEFINE_WRAPPERTYPEINFO(); |
24 public: | 25 public: |
25 static PassRefPtr<GestureEvent> create() | 26 static PassRefPtr<GestureEvent> create() |
26 { | 27 { |
27 return adoptRef(new GestureEvent); | 28 return adoptRef(new GestureEvent); |
28 } | 29 } |
29 static PassRefPtr<GestureEvent> create(const WebGestureEvent& event) | 30 static PassRefPtr<GestureEvent> create(const WebGestureEvent& event) |
30 { | 31 { |
31 return adoptRef(new GestureEvent(event)); | 32 return adoptRef(new GestureEvent(event)); |
32 } | 33 } |
33 static PassRefPtr<GestureEvent> create(const AtomicString& type, const Gestu reEventInit& initializer) | 34 static PassRefPtr<GestureEvent> create(const AtomicString& type, const Gestu reEventInit& initializer) |
34 { | 35 { |
35 return adoptRef(new GestureEvent(type, initializer)); | 36 return adoptRef(new GestureEvent(type, initializer)); |
36 } | 37 } |
37 | 38 |
38 ~GestureEvent() override; | 39 ~GestureEvent() override; |
39 const AtomicString& interfaceName() const override; | 40 const AtomicString& interfaceName() const override; |
40 | 41 |
42 int primaryPointer() const { return m_primaryPointer; } | |
eseidel
2015/03/19 18:00:36
dart 'get' has spoiled me.
| |
41 float x() const { return m_x; } | 43 float x() const { return m_x; } |
42 float y() const { return m_y; } | 44 float y() const { return m_y; } |
43 float dx() const { return m_dx; } | 45 float dx() const { return m_dx; } |
44 float dy() const { return m_dy; } | 46 float dy() const { return m_dy; } |
45 float velocityX() const { return m_velocityX; } | 47 float velocityX() const { return m_velocityX; } |
46 float velocityY() const { return m_velocityY; } | 48 float velocityY() const { return m_velocityY; } |
47 | 49 |
48 private: | 50 private: |
49 GestureEvent(); | 51 GestureEvent(); |
50 explicit GestureEvent(const WebGestureEvent&); | 52 explicit GestureEvent(const WebGestureEvent&); |
51 GestureEvent(const AtomicString& type, const GestureEventInit&); | 53 GestureEvent(const AtomicString& type, const GestureEventInit&); |
52 | 54 |
55 int m_primaryPointer; | |
53 float m_x; | 56 float m_x; |
54 float m_y; | 57 float m_y; |
55 float m_dx; | 58 float m_dx; |
56 float m_dy; | 59 float m_dy; |
57 float m_velocityX; | 60 float m_velocityX; |
58 float m_velocityY; | 61 float m_velocityY; |
59 }; | 62 }; |
60 | 63 |
61 } // namespace blink | 64 } // namespace blink |
62 | 65 |
63 #endif // SKY_ENGINE_CORE_EVENTS_GESTUREEVENT_H_ | 66 #endif // SKY_ENGINE_CORE_EVENTS_GESTUREEVENT_H_ |
OLD | NEW |