1 | import { Point } from '../shapes/Point';
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 | var FederatedEvent =
|
8 |
|
9 | function () {
|
10 | |
11 |
|
12 |
|
13 |
|
14 | function FederatedEvent(manager) {
|
15 | |
16 |
|
17 |
|
18 |
|
19 | this.eventPhase = FederatedEvent.prototype.NONE;
|
20 | |
21 |
|
22 |
|
23 |
|
24 | this.bubbles = true;
|
25 | |
26 |
|
27 |
|
28 |
|
29 | this.cancelBubble = true;
|
30 | |
31 |
|
32 |
|
33 |
|
34 | this.cancelable = false;
|
35 |
|
36 |
|
37 | this.defaultPrevented = false;
|
38 |
|
39 |
|
40 | this.propagationStopped = false;
|
41 |
|
42 |
|
43 | this.propagationImmediatelyStopped = false;
|
44 | |
45 |
|
46 |
|
47 |
|
48 |
|
49 | this.layer = new Point();
|
50 | |
51 |
|
52 |
|
53 |
|
54 |
|
55 |
|
56 |
|
57 | this.page = new Point();
|
58 | |
59 |
|
60 |
|
61 |
|
62 | this.canvas = new Point();
|
63 | |
64 |
|
65 |
|
66 |
|
67 | this.viewport = new Point();
|
68 | this.composed = false;
|
69 | this.NONE = 0;
|
70 | this.CAPTURING_PHASE = 1;
|
71 | this.AT_TARGET = 2;
|
72 | this.BUBBLING_PHASE = 3;
|
73 | this.manager = manager;
|
74 | }
|
75 |
|
76 | Object.defineProperty(FederatedEvent.prototype, "name", {
|
77 | |
78 |
|
79 |
|
80 | get: function get() {
|
81 | return this.type;
|
82 | },
|
83 | enumerable: false,
|
84 | configurable: true
|
85 | });
|
86 | Object.defineProperty(FederatedEvent.prototype, "layerX", {
|
87 | get: function get() {
|
88 | return this.layer.x;
|
89 | },
|
90 | enumerable: false,
|
91 | configurable: true
|
92 | });
|
93 | Object.defineProperty(FederatedEvent.prototype, "layerY", {
|
94 | get: function get() {
|
95 | return this.layer.y;
|
96 | },
|
97 | enumerable: false,
|
98 | configurable: true
|
99 | });
|
100 | Object.defineProperty(FederatedEvent.prototype, "pageX", {
|
101 | get: function get() {
|
102 | return this.page.x;
|
103 | },
|
104 | enumerable: false,
|
105 | configurable: true
|
106 | });
|
107 | Object.defineProperty(FederatedEvent.prototype, "pageY", {
|
108 | get: function get() {
|
109 | return this.page.y;
|
110 | },
|
111 | enumerable: false,
|
112 | configurable: true
|
113 | });
|
114 | Object.defineProperty(FederatedEvent.prototype, "x", {
|
115 | get: function get() {
|
116 | return this.canvas.x;
|
117 | },
|
118 | enumerable: false,
|
119 | configurable: true
|
120 | });
|
121 | Object.defineProperty(FederatedEvent.prototype, "y", {
|
122 | get: function get() {
|
123 | return this.canvas.y;
|
124 | },
|
125 | enumerable: false,
|
126 | configurable: true
|
127 | });
|
128 | Object.defineProperty(FederatedEvent.prototype, "canvasX", {
|
129 | get: function get() {
|
130 | return this.canvas.x;
|
131 | },
|
132 | enumerable: false,
|
133 | configurable: true
|
134 | });
|
135 | Object.defineProperty(FederatedEvent.prototype, "canvasY", {
|
136 | get: function get() {
|
137 | return this.canvas.y;
|
138 | },
|
139 | enumerable: false,
|
140 | configurable: true
|
141 | });
|
142 | Object.defineProperty(FederatedEvent.prototype, "viewportX", {
|
143 | get: function get() {
|
144 | return this.viewport.x;
|
145 | },
|
146 | enumerable: false,
|
147 | configurable: true
|
148 | });
|
149 | Object.defineProperty(FederatedEvent.prototype, "viewportY", {
|
150 | get: function get() {
|
151 | return this.viewport.y;
|
152 | },
|
153 | enumerable: false,
|
154 | configurable: true
|
155 | });
|
156 | |
157 |
|
158 |
|
159 |
|
160 |
|
161 |
|
162 |
|
163 |
|
164 | FederatedEvent.prototype.composedPath = function () {
|
165 | if (this.manager && (!this.path || this.path[0] !== this.target)) {
|
166 | this.path = this.target ? this.manager.propagationPath(this.target) : [];
|
167 | }
|
168 |
|
169 | return this.path;
|
170 | };
|
171 |
|
172 | Object.defineProperty(FederatedEvent.prototype, "propagationPath", {
|
173 | |
174 |
|
175 |
|
176 | get: function get() {
|
177 | return this.composedPath();
|
178 | },
|
179 | enumerable: false,
|
180 | configurable: true
|
181 | });
|
182 | |
183 |
|
184 |
|
185 |
|
186 | FederatedEvent.prototype.preventDefault = function () {
|
187 | if (this.nativeEvent instanceof Event && this.nativeEvent.cancelable) {
|
188 | this.nativeEvent.preventDefault();
|
189 | }
|
190 |
|
191 | this.defaultPrevented = true;
|
192 | };
|
193 | |
194 |
|
195 |
|
196 |
|
197 |
|
198 | FederatedEvent.prototype.stopImmediatePropagation = function () {
|
199 | this.propagationImmediatelyStopped = true;
|
200 | };
|
201 | |
202 |
|
203 |
|
204 |
|
205 |
|
206 | FederatedEvent.prototype.stopPropagation = function () {
|
207 | this.propagationStopped = true;
|
208 | };
|
209 | |
210 |
|
211 |
|
212 |
|
213 |
|
214 |
|
215 | FederatedEvent.prototype.initEvent = function () {};
|
216 |
|
217 | FederatedEvent.prototype.initUIEvent = function () {};
|
218 |
|
219 | return FederatedEvent;
|
220 | }();
|
221 |
|
222 | export { FederatedEvent }; |
\ | No newline at end of file |