swf2js 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -9
- package/package.json +2 -1
- package/src/cli.js +15 -6
- package/src/emitter/bundle-emitter.js +56 -16
- package/src/runtime/avm1-runtime.js +329 -84
- package/src/runtime/avm2-runtime.js +56 -6
- package/src/runtime/embedded-movie-runtime.js +6 -1
- package/src/runtime/index.js +2 -6
- package/src/runtime/movie-runtime.js +2 -1
- package/src/runtime/swflib/assemble.js +34 -0
- package/src/runtime/swflib/bitmap-image.js +4 -0
- package/src/runtime/swflib/bitmap.js +1004 -0
- package/src/runtime/swflib/builtins.js +156 -0
- package/src/runtime/swflib/bytearray.js +949 -0
- package/src/runtime/swflib/compiled-swf.js +3 -0
- package/src/runtime/swflib/context-menu.js +245 -0
- package/src/runtime/swflib/cursor-flag.js +12 -0
- package/src/runtime/swflib/dictionary.js +121 -0
- package/src/runtime/swflib/display.js +823 -0
- package/src/runtime/swflib/events.js +754 -0
- package/src/runtime/swflib/filters.js +298 -0
- package/src/runtime/swflib/flash.js +130 -0
- package/src/runtime/swflib/geom.js +759 -0
- package/src/runtime/swflib/glyph-metrics.js +14 -0
- package/src/runtime/swflib/graphics.js +735 -0
- package/src/runtime/swflib/host.js +2 -0
- package/src/runtime/swflib/inherit.js +22 -0
- package/src/runtime/swflib/input.js +1085 -0
- package/src/runtime/swflib/loader.js +687 -0
- package/src/runtime/swflib/marks.js +16 -0
- package/src/runtime/swflib/matrix3d.js +144 -0
- package/src/runtime/swflib/pointer-bridge.js +8 -0
- package/src/runtime/swflib/projection.js +158 -0
- package/src/runtime/swflib/render.js +1240 -0
- package/src/runtime/swflib/sound.js +1166 -0
- package/src/runtime/swflib/sprite-drag.js +116 -0
- package/src/runtime/swflib/stage-ref.js +9 -0
- package/src/runtime/swflib/stage.js +484 -0
- package/src/runtime/swflib/system.js +987 -0
- package/src/runtime/swflib/text-field.js +519 -0
- package/src/runtime/swflib/text-paint.js +797 -0
- package/src/runtime/swflib/text.js +1387 -0
- package/src/runtime/swflib/transform.js +133 -0
- package/src/runtime/swflib/xml.js +268 -0
- package/src/transpiler/avm1/avm1-ir.js +2 -1
- package/src/transpiler/avm1/avm1-rewrite.js +23 -2
- package/src/transpiler/avm1/avm1-transpiler.js +4 -1
- package/src/transpiler/avm2/avm2-transpiler.js +38 -7
- package/src/transpiler/timeline/timeline-codegen.js +366 -123
- package/src/runtime/swflib.js +0 -14050
|
@@ -0,0 +1,754 @@
|
|
|
1
|
+
import { ByteArray, Endian } from './bytearray.js';
|
|
2
|
+
import { Point } from './geom.js';
|
|
3
|
+
import { isDisplayObject } from './marks.js';
|
|
4
|
+
|
|
5
|
+
// ---- events ----
|
|
6
|
+
export class Event {
|
|
7
|
+
static CAPTURING_PHASE = 1;
|
|
8
|
+
static AT_TARGET = 2;
|
|
9
|
+
static BUBBLING_PHASE = 3;
|
|
10
|
+
static ENTER_FRAME = 'enterFrame';
|
|
11
|
+
static ADDED = 'added';
|
|
12
|
+
static ADDED_TO_STAGE = 'addedToStage';
|
|
13
|
+
static REMOVED = 'removed';
|
|
14
|
+
static REMOVED_FROM_STAGE = 'removedFromStage';
|
|
15
|
+
static FRAME_CONSTRUCTED = 'frameConstructed';
|
|
16
|
+
static EXIT_FRAME = 'exitFrame';
|
|
17
|
+
static RENDER = 'render';
|
|
18
|
+
static COMPLETE = 'complete';
|
|
19
|
+
static INIT = 'init';
|
|
20
|
+
static RESIZE = 'resize';
|
|
21
|
+
static IO_ERROR = 'ioError';
|
|
22
|
+
static OPEN = 'open';
|
|
23
|
+
static ID3 = 'id3';
|
|
24
|
+
static SOUND_COMPLETE = 'soundComplete';
|
|
25
|
+
static CHANGE = 'change';
|
|
26
|
+
static SCROLL = 'scroll';
|
|
27
|
+
static TAB_CHILDREN_CHANGE = 'tabChildrenChange';
|
|
28
|
+
static TAB_ENABLED_CHANGE = 'tabEnabledChange';
|
|
29
|
+
static TAB_INDEX_CHANGE = 'tabIndexChange';
|
|
30
|
+
static SELECT = 'select';
|
|
31
|
+
static CANCEL = 'cancel';
|
|
32
|
+
static CLOSE = 'close';
|
|
33
|
+
static ACTIVATE = 'activate';
|
|
34
|
+
static DEACTIVATE = 'deactivate';
|
|
35
|
+
static FULLSCREEN = 'fullScreen';
|
|
36
|
+
static MOUSE_LEAVE = 'mouseLeave';
|
|
37
|
+
|
|
38
|
+
constructor(type, bubbles, cancelable) {
|
|
39
|
+
this.type = type;
|
|
40
|
+
this.bubbles = !!bubbles;
|
|
41
|
+
this.cancelable = !!cancelable;
|
|
42
|
+
this._eventTarget = null;
|
|
43
|
+
this._eventCurrentTarget = null;
|
|
44
|
+
this._eventPhase = 0;
|
|
45
|
+
this.defaultPrevented = false;
|
|
46
|
+
this._propagationStopped = false;
|
|
47
|
+
this._immediatePropagationStopped = false;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
get target() { return this._eventTarget; }
|
|
51
|
+
get currentTarget() { return this._eventCurrentTarget; }
|
|
52
|
+
get eventPhase() { return this._eventPhase; }
|
|
53
|
+
|
|
54
|
+
clone() { return new Event(this.type, this.bubbles, this.cancelable); }
|
|
55
|
+
stopPropagation() { this._propagationStopped = true; }
|
|
56
|
+
stopImmediatePropagation() {
|
|
57
|
+
this._immediatePropagationStopped = true;
|
|
58
|
+
this._propagationStopped = true;
|
|
59
|
+
}
|
|
60
|
+
preventDefault() {
|
|
61
|
+
if (this.cancelable) this.defaultPrevented = true;
|
|
62
|
+
}
|
|
63
|
+
isDefaultPrevented() { return !!this.defaultPrevented; }
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export class TextEvent extends Event {
|
|
67
|
+
static LINK = 'link';
|
|
68
|
+
static TEXT_INPUT = 'textInput';
|
|
69
|
+
constructor(type, bubbles, cancelable, text) {
|
|
70
|
+
super(type || TextEvent.LINK, bubbles, cancelable);
|
|
71
|
+
this.text = text == null ? '' : String(text);
|
|
72
|
+
}
|
|
73
|
+
clone() { return new TextEvent(this.type, this.bubbles, this.cancelable, this.text); }
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export class IOErrorEvent extends Event {
|
|
77
|
+
static IO_ERROR = 'ioError';
|
|
78
|
+
constructor(type, bubbles, cancelable, text, id) {
|
|
79
|
+
super(type || Event.IO_ERROR, bubbles, cancelable);
|
|
80
|
+
this.text = text || '';
|
|
81
|
+
this.errorID = id | 0;
|
|
82
|
+
}
|
|
83
|
+
clone() { return new IOErrorEvent(this.type, this.bubbles, this.cancelable, this.text, this.errorID); }
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export class ProgressEvent extends Event {
|
|
87
|
+
static PROGRESS = 'progress';
|
|
88
|
+
static SOCKET_DATA = 'socketData';
|
|
89
|
+
constructor(type, bubbles, cancelable, bytesLoaded, bytesTotal) {
|
|
90
|
+
super(type || ProgressEvent.PROGRESS, bubbles, cancelable);
|
|
91
|
+
this.bytesLoaded = +bytesLoaded || 0;
|
|
92
|
+
this.bytesTotal = +bytesTotal || 0;
|
|
93
|
+
}
|
|
94
|
+
clone() {
|
|
95
|
+
return new ProgressEvent(this.type, this.bubbles, this.cancelable, this.bytesLoaded, this.bytesTotal);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export class HTTPStatusEvent extends Event {
|
|
100
|
+
static HTTP_STATUS = 'httpStatus';
|
|
101
|
+
static HTTP_RESPONSE_STATUS = 'httpResponseStatus';
|
|
102
|
+
constructor(type, bubbles, cancelable, status, responseURL, responseHeaders, redirected) {
|
|
103
|
+
super(type || HTTPStatusEvent.HTTP_STATUS, bubbles, cancelable);
|
|
104
|
+
this.status = status | 0;
|
|
105
|
+
this.responseURL = responseURL || '';
|
|
106
|
+
this.responseHeaders = responseHeaders || [];
|
|
107
|
+
this.redirected = !!redirected;
|
|
108
|
+
}
|
|
109
|
+
clone() {
|
|
110
|
+
return new HTTPStatusEvent(this.type, this.bubbles, this.cancelable, this.status, this.responseURL, this.responseHeaders, this.redirected);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export class StatusEvent extends Event {
|
|
115
|
+
static STATUS = 'status';
|
|
116
|
+
constructor(type, bubbles, cancelable, code, level) {
|
|
117
|
+
super(type || StatusEvent.STATUS, bubbles, cancelable);
|
|
118
|
+
this.code = code == null ? '' : String(code);
|
|
119
|
+
this.level = level == null ? '' : String(level);
|
|
120
|
+
}
|
|
121
|
+
clone() { return new StatusEvent(this.type, this.bubbles, this.cancelable, this.code, this.level); }
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export class AsyncErrorEvent extends Event {
|
|
125
|
+
static ASYNC_ERROR = 'asyncError';
|
|
126
|
+
constructor(type, bubbles, cancelable, text, error) {
|
|
127
|
+
super(type || AsyncErrorEvent.ASYNC_ERROR, bubbles, cancelable);
|
|
128
|
+
this.text = text == null ? '' : String(text);
|
|
129
|
+
this.error = error;
|
|
130
|
+
}
|
|
131
|
+
clone() { return new AsyncErrorEvent(this.type, this.bubbles, this.cancelable, this.text, this.error); }
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export class TimerEvent extends Event {
|
|
135
|
+
static TIMER = 'timer';
|
|
136
|
+
static TIMER_COMPLETE = 'timerComplete';
|
|
137
|
+
constructor(type, bubbles, cancelable) {
|
|
138
|
+
super(type || TimerEvent.TIMER, bubbles, cancelable);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export class SecurityErrorEvent extends Event {
|
|
143
|
+
static SECURITY_ERROR = 'securityError';
|
|
144
|
+
constructor(type, bubbles, cancelable, text, id) {
|
|
145
|
+
super(type || SecurityErrorEvent.SECURITY_ERROR, bubbles, cancelable);
|
|
146
|
+
this.text = text || '';
|
|
147
|
+
this.errorID = id | 0;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export class KeyboardEvent extends Event {
|
|
152
|
+
static KEY_DOWN = 'keyDown';
|
|
153
|
+
static KEY_UP = 'keyUp';
|
|
154
|
+
constructor(type, bubbles, cancelable, charCode, keyCode, keyLocation, ctrlKey, altKey, shiftKey, controlKey, commandKey) {
|
|
155
|
+
super(type || KeyboardEvent.KEY_DOWN, bubbles, cancelable);
|
|
156
|
+
this.charCode = charCode >>> 0;
|
|
157
|
+
this.keyCode = keyCode >>> 0;
|
|
158
|
+
this.keyLocation = keyLocation >>> 0;
|
|
159
|
+
this.ctrlKey = !!ctrlKey;
|
|
160
|
+
this.altKey = !!altKey;
|
|
161
|
+
this.shiftKey = !!shiftKey;
|
|
162
|
+
this.controlKey = !!controlKey;
|
|
163
|
+
this.commandKey = !!commandKey;
|
|
164
|
+
}
|
|
165
|
+
clone() {
|
|
166
|
+
return new KeyboardEvent(this.type, this.bubbles, this.cancelable, this.charCode, this.keyCode,
|
|
167
|
+
this.keyLocation, this.ctrlKey, this.altKey, this.shiftKey, this.controlKey, this.commandKey);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export class FocusEvent extends Event {
|
|
172
|
+
static FOCUS_IN = 'focusIn';
|
|
173
|
+
static FOCUS_OUT = 'focusOut';
|
|
174
|
+
static KEY_FOCUS_CHANGE = 'keyFocusChange';
|
|
175
|
+
static MOUSE_FOCUS_CHANGE = 'mouseFocusChange';
|
|
176
|
+
constructor(type, bubbles, cancelable, relatedObject, shiftKey, keyCode) {
|
|
177
|
+
super(type || FocusEvent.FOCUS_IN, bubbles, cancelable);
|
|
178
|
+
this.relatedObject = relatedObject || null;
|
|
179
|
+
this.shiftKey = !!shiftKey;
|
|
180
|
+
this.keyCode = keyCode | 0;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
export class ContextMenuEvent extends Event {
|
|
185
|
+
static MENU_SELECT = 'menuSelect';
|
|
186
|
+
static MENU_ITEM_SELECT = 'menuItemSelect';
|
|
187
|
+
constructor(type, bubbles, cancelable, mouseTarget, contextMenuOwner) {
|
|
188
|
+
super(type, bubbles, cancelable);
|
|
189
|
+
this.mouseTarget = mouseTarget || null;
|
|
190
|
+
this.contextMenuOwner = contextMenuOwner || null;
|
|
191
|
+
}
|
|
192
|
+
clone() {
|
|
193
|
+
return new ContextMenuEvent(this.type, this.bubbles, this.cancelable, this.mouseTarget, this.contextMenuOwner);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
export class StageScaleMode {
|
|
198
|
+
static SHOW_ALL = 'showAll';
|
|
199
|
+
static NO_SCALE = 'noScale';
|
|
200
|
+
static EXACT_FIT = 'exactFit';
|
|
201
|
+
static NO_BORDER = 'noBorder';
|
|
202
|
+
}
|
|
203
|
+
export class StageAlign {
|
|
204
|
+
static TOP = 'T';
|
|
205
|
+
static BOTTOM = 'B';
|
|
206
|
+
static LEFT = 'L';
|
|
207
|
+
static RIGHT = 'R';
|
|
208
|
+
static TOP_LEFT = 'TL';
|
|
209
|
+
static TOP_RIGHT = 'TR';
|
|
210
|
+
static BOTTOM_LEFT = 'BL';
|
|
211
|
+
static BOTTOM_RIGHT = 'BR';
|
|
212
|
+
}
|
|
213
|
+
export class StageQuality {
|
|
214
|
+
static LOW = 'low';
|
|
215
|
+
static MEDIUM = 'medium';
|
|
216
|
+
static HIGH = 'high';
|
|
217
|
+
static BEST = 'best';
|
|
218
|
+
}
|
|
219
|
+
export class TextFieldType {
|
|
220
|
+
static DYNAMIC = 'dynamic';
|
|
221
|
+
static INPUT = 'input';
|
|
222
|
+
}
|
|
223
|
+
export class TextFieldAutoSize {
|
|
224
|
+
static NONE = 'none';
|
|
225
|
+
static LEFT = 'left';
|
|
226
|
+
static CENTER = 'center';
|
|
227
|
+
static RIGHT = 'right';
|
|
228
|
+
}
|
|
229
|
+
export class AntiAliasType {
|
|
230
|
+
static NORMAL = 'normal';
|
|
231
|
+
static ADVANCED = 'advanced';
|
|
232
|
+
}
|
|
233
|
+
export class GridFitType {
|
|
234
|
+
static NONE = 'none';
|
|
235
|
+
static PIXEL = 'pixel';
|
|
236
|
+
static SUBPIXEL = 'subpixel';
|
|
237
|
+
}
|
|
238
|
+
export var csmGridFitTypes = [GridFitType.NONE, GridFitType.PIXEL, GridFitType.SUBPIXEL];
|
|
239
|
+
export class BlendMode {
|
|
240
|
+
static NORMAL = 'normal';
|
|
241
|
+
static LAYER = 'layer';
|
|
242
|
+
static MULTIPLY = 'multiply';
|
|
243
|
+
static SCREEN = 'screen';
|
|
244
|
+
static LIGHTEN = 'lighten';
|
|
245
|
+
static DARKEN = 'darken';
|
|
246
|
+
static ADD = 'add';
|
|
247
|
+
static SUBTRACT = 'subtract';
|
|
248
|
+
static DIFFERENCE = 'difference';
|
|
249
|
+
static INVERT = 'invert';
|
|
250
|
+
static OVERLAY = 'overlay';
|
|
251
|
+
static HARDLIGHT = 'hardlight';
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
export class EventDispatcher {
|
|
255
|
+
constructor() { this._listeners = Object.create(null); }
|
|
256
|
+
|
|
257
|
+
addEventListener(type, fn, useCapture, priority, useWeakReference) {
|
|
258
|
+
if (typeof fn !== 'function') return;
|
|
259
|
+
if (!this._listeners[type]) this._listeners[type] = [];
|
|
260
|
+
var list = this._listeners[type];
|
|
261
|
+
pruneEventListeners(list);
|
|
262
|
+
useCapture = !!useCapture;
|
|
263
|
+
for (var i = 0; i < list.length; i++) {
|
|
264
|
+
if (getEventListener(list[i]) === fn && list[i].useCapture === useCapture) return;
|
|
265
|
+
}
|
|
266
|
+
var weak = !!useWeakReference && typeof WeakRef === 'function';
|
|
267
|
+
var listenerPriority = priority == null ? 0 : Number(priority) | 0;
|
|
268
|
+
var item = weak
|
|
269
|
+
? { ref: new WeakRef(fn), weak: true, useCapture: useCapture, priority: listenerPriority, order: EventDispatcher._listenerOrder++ }
|
|
270
|
+
: { fn: fn, useCapture: useCapture, priority: listenerPriority, order: EventDispatcher._listenerOrder++ };
|
|
271
|
+
list.push(item);
|
|
272
|
+
list.sort(function (a, b) { return b.priority - a.priority || a.order - b.order; });
|
|
273
|
+
if (isFrameBroadcast(type) && !useCapture && isDisplayObject(this) && !enterFrameSubscriptions.has(this)) {
|
|
274
|
+
var receiver = weakFrameReceivers ? new WeakRef(this) : this;
|
|
275
|
+
enterFrameReceivers.add(receiver);
|
|
276
|
+
enterFrameSubscriptions.set(this, receiver);
|
|
277
|
+
}
|
|
278
|
+
// Flash activate/deactivate/render broadcast to every EventDispatcher with a
|
|
279
|
+
// non-capturing listener, including objects that are not on the display list.
|
|
280
|
+
if (isStageBroadcast(type) && !useCapture && !stageBroadcastSubscriptions.has(this)) {
|
|
281
|
+
var stageReceiver = weakFrameReceivers ? new WeakRef(this) : this;
|
|
282
|
+
stageBroadcastReceivers.add(stageReceiver);
|
|
283
|
+
stageBroadcastSubscriptions.set(this, stageReceiver);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
removeEventListener(type, fn, useCapture) {
|
|
288
|
+
var list = this._listeners[type];
|
|
289
|
+
if (!list) return;
|
|
290
|
+
useCapture = !!useCapture;
|
|
291
|
+
for (var i = list.length - 1; i >= 0; i--) {
|
|
292
|
+
if (!getEventListener(list[i]) || (getEventListener(list[i]) === fn && list[i].useCapture === useCapture)) list.splice(i, 1);
|
|
293
|
+
}
|
|
294
|
+
if (isFrameBroadcast(type) && !hasFrameBroadcast(this)) unregisterEnterFrameReceiver(this);
|
|
295
|
+
if (isStageBroadcast(type) && !hasStageBroadcast(this)) unregisterStageBroadcastReceiver(this);
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
dispatchEvent(e) {
|
|
299
|
+
if (!e || !e.type) return true;
|
|
300
|
+
if ((e instanceof Event ? e._eventTarget : e.target) && typeof e.clone === 'function') e = e.clone();
|
|
301
|
+
var nativeEvent = e instanceof Event;
|
|
302
|
+
if (nativeEvent) e._eventTarget = this;
|
|
303
|
+
else e.target = this;
|
|
304
|
+
function setCurrentTarget(target, phase) {
|
|
305
|
+
if (nativeEvent) {
|
|
306
|
+
e._eventCurrentTarget = target;
|
|
307
|
+
e._eventPhase = phase;
|
|
308
|
+
} else {
|
|
309
|
+
e.currentTarget = target;
|
|
310
|
+
e.eventPhase = phase;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
e._propagationStopped = false;
|
|
314
|
+
e._immediatePropagationStopped = false;
|
|
315
|
+
var path = [];
|
|
316
|
+
var direct = directFrameEvents.has(e);
|
|
317
|
+
var node = direct ? null : this.parent;
|
|
318
|
+
while (node) { path.push(node); node = node.parent; }
|
|
319
|
+
|
|
320
|
+
function invoke(target, capture, phase) {
|
|
321
|
+
setCurrentTarget(target, phase);
|
|
322
|
+
e._immediatePropagationStopped = false;
|
|
323
|
+
var list = target && target._listeners && target._listeners[e.type];
|
|
324
|
+
if (!list) return;
|
|
325
|
+
// Copy in case a listener adds/removes listeners during dispatch.
|
|
326
|
+
list = list.slice();
|
|
327
|
+
for (var i = 0; i < list.length; i++) {
|
|
328
|
+
if (list[i].useCapture !== capture) continue;
|
|
329
|
+
var fn = getEventListener(list[i]);
|
|
330
|
+
if (!fn) continue;
|
|
331
|
+
try { fn.call(target, e); } catch (_) {}
|
|
332
|
+
if (e._immediatePropagationStopped) break;
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
for (var p = path.length - 1; p >= 0 && !e._propagationStopped; p--) {
|
|
337
|
+
invoke(path[p], true, Event.CAPTURING_PHASE);
|
|
338
|
+
}
|
|
339
|
+
if (!e._propagationStopped) {
|
|
340
|
+
if (!direct) invoke(this, true, Event.AT_TARGET);
|
|
341
|
+
if (!e._immediatePropagationStopped) invoke(this, false, Event.AT_TARGET);
|
|
342
|
+
}
|
|
343
|
+
if (e.bubbles && !e._propagationStopped) {
|
|
344
|
+
for (var b = 0; b < path.length && !e._propagationStopped; b++) {
|
|
345
|
+
invoke(path[b], false, Event.BUBBLING_PHASE);
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
setCurrentTarget(null, 0);
|
|
349
|
+
return !e.defaultPrevented;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
hasEventListener(type) {
|
|
353
|
+
var list = this._listeners[type];
|
|
354
|
+
if (!list) return false;
|
|
355
|
+
pruneEventListeners(list);
|
|
356
|
+
return list.length > 0;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
willTrigger(type) {
|
|
360
|
+
var node = this;
|
|
361
|
+
while (node) {
|
|
362
|
+
if (typeof node.hasEventListener === 'function' && node.hasEventListener(type)) return true;
|
|
363
|
+
node = node.parent || null;
|
|
364
|
+
}
|
|
365
|
+
return false;
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
EventDispatcher._listenerOrder = 0;
|
|
369
|
+
export var enterFrameReceivers = new Set();
|
|
370
|
+
export var enterFrameSubscriptions = new WeakMap();
|
|
371
|
+
export var stageBroadcastReceivers = new Set();
|
|
372
|
+
export var stageBroadcastSubscriptions = new WeakMap();
|
|
373
|
+
export var directFrameEvents = new WeakSet();
|
|
374
|
+
export var weakFrameReceivers = typeof WeakRef === 'function';
|
|
375
|
+
export function unregisterEnterFrameReceiver(target) {
|
|
376
|
+
enterFrameReceivers.delete(enterFrameSubscriptions.get(target));
|
|
377
|
+
enterFrameSubscriptions.delete(target);
|
|
378
|
+
}
|
|
379
|
+
export function unregisterStageBroadcastReceiver(target) {
|
|
380
|
+
stageBroadcastReceivers.delete(stageBroadcastSubscriptions.get(target));
|
|
381
|
+
stageBroadcastSubscriptions.delete(target);
|
|
382
|
+
}
|
|
383
|
+
export function hasDirectFrameListener(target, type) {
|
|
384
|
+
return target._listeners?.[type]?.some(function (listener) {
|
|
385
|
+
return !listener.useCapture && getEventListener(listener);
|
|
386
|
+
});
|
|
387
|
+
}
|
|
388
|
+
export function isFrameBroadcast(type) {
|
|
389
|
+
return type === Event.ENTER_FRAME || type === Event.FRAME_CONSTRUCTED || type === Event.EXIT_FRAME;
|
|
390
|
+
}
|
|
391
|
+
export function isStageBroadcast(type) {
|
|
392
|
+
return type === Event.ACTIVATE || type === Event.DEACTIVATE || type === Event.RENDER;
|
|
393
|
+
}
|
|
394
|
+
export function hasFrameBroadcast(target) {
|
|
395
|
+
return hasDirectFrameListener(target, Event.ENTER_FRAME) ||
|
|
396
|
+
hasDirectFrameListener(target, Event.FRAME_CONSTRUCTED) ||
|
|
397
|
+
hasDirectFrameListener(target, Event.EXIT_FRAME);
|
|
398
|
+
}
|
|
399
|
+
export function hasStageBroadcast(target) {
|
|
400
|
+
return hasDirectFrameListener(target, Event.ACTIVATE) ||
|
|
401
|
+
hasDirectFrameListener(target, Event.DEACTIVATE) ||
|
|
402
|
+
hasDirectFrameListener(target, Event.RENDER);
|
|
403
|
+
}
|
|
404
|
+
export function dispatchStageBroadcast(type) {
|
|
405
|
+
if (!isStageBroadcast(type)) return;
|
|
406
|
+
var registered = Array.from(stageBroadcastReceivers);
|
|
407
|
+
for (var receiver of registered) {
|
|
408
|
+
if (!stageBroadcastReceivers.has(receiver)) continue;
|
|
409
|
+
var target = weakFrameReceivers ? receiver.deref() : receiver;
|
|
410
|
+
if (!target) stageBroadcastReceivers.delete(receiver);
|
|
411
|
+
else if (!hasStageBroadcast(target)) unregisterStageBroadcastReceiver(target);
|
|
412
|
+
else if (hasDirectFrameListener(target, type)) dispatchDirectFrameEvent(target, type);
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
export var frameConstructedToken = 0;
|
|
416
|
+
export function beginFrameConstruction() {
|
|
417
|
+
frameConstructedToken++;
|
|
418
|
+
}
|
|
419
|
+
export function dispatchOffstageFrameConstructed(target) {
|
|
420
|
+
if (!target) return;
|
|
421
|
+
target._swoofConstructedToken = frameConstructedToken;
|
|
422
|
+
if (hasDirectFrameListener(target, Event.FRAME_CONSTRUCTED)) dispatchDirectFrameEvent(target, Event.FRAME_CONSTRUCTED);
|
|
423
|
+
}
|
|
424
|
+
export function dispatchDirectFrameEvent(target, type) {
|
|
425
|
+
var event = new Event(type);
|
|
426
|
+
directFrameEvents.add(event);
|
|
427
|
+
try { target.dispatchEvent(event); } catch (_) {}
|
|
428
|
+
}
|
|
429
|
+
export function getEventListener(item) {
|
|
430
|
+
return item && item.weak ? (item.ref && item.ref.deref()) : item && item.fn;
|
|
431
|
+
}
|
|
432
|
+
export function pruneEventListeners(list) {
|
|
433
|
+
for (var i = list.length - 1; i >= 0; i--) if (!getEventListener(list[i])) list.splice(i, 1);
|
|
434
|
+
}
|
|
435
|
+
export class IEventDispatcher {
|
|
436
|
+
constructor() { throw new TypeError('Interfaces cannot be instantiated'); }
|
|
437
|
+
}
|
|
438
|
+
export var eventDispatcherInterfaceTraits = [
|
|
439
|
+
'addEventListener', 'removeEventListener', 'dispatchEvent', 'hasEventListener', 'willTrigger',
|
|
440
|
+
].map(function (name) {
|
|
441
|
+
// AVM2 namespace keys use the FNV-1a hash of the interface URI.
|
|
442
|
+
var key = '__avm2ns_8_uri_7591ddd2_' + name;
|
|
443
|
+
Object.defineProperty(EventDispatcher.prototype, key, {
|
|
444
|
+
configurable: true,
|
|
445
|
+
value: function () { return this[name].apply(this, arguments); },
|
|
446
|
+
});
|
|
447
|
+
return [key, name, 1];
|
|
448
|
+
});
|
|
449
|
+
Object.defineProperty(IEventDispatcher, '__avm2InterfaceTraits', { value: eventDispatcherInterfaceTraits });
|
|
450
|
+
Object.defineProperty(EventDispatcher, '__avm2Interfaces', { value: [IEventDispatcher] });
|
|
451
|
+
|
|
452
|
+
export class Timer extends EventDispatcher {
|
|
453
|
+
constructor(delay, repeatCount) {
|
|
454
|
+
super();
|
|
455
|
+
this.delay = +delay || 0;
|
|
456
|
+
this.repeatCount = repeatCount | 0;
|
|
457
|
+
this.currentCount = 0;
|
|
458
|
+
this.running = false;
|
|
459
|
+
this._id = null;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
start() {
|
|
463
|
+
if (this.running) return;
|
|
464
|
+
var self = this;
|
|
465
|
+
var scheduler = this._scheduler || rootTimers;
|
|
466
|
+
var id = scheduler.startTimer(this, function () {
|
|
467
|
+
self.currentCount++;
|
|
468
|
+
try { self.dispatchEvent(new TimerEvent(TimerEvent.TIMER)); } catch (_) {}
|
|
469
|
+
if (self._id === id && self.repeatCount > 0 && self.currentCount >= self.repeatCount) {
|
|
470
|
+
self.stop();
|
|
471
|
+
try { self.dispatchEvent(new TimerEvent(TimerEvent.TIMER_COMPLETE)); } catch (_) {}
|
|
472
|
+
}
|
|
473
|
+
}, function () { self.running = false; self._id = null; });
|
|
474
|
+
this._id = id || null;
|
|
475
|
+
this.running = !!id;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
stop() {
|
|
479
|
+
this.running = false;
|
|
480
|
+
if (this._id != null) {
|
|
481
|
+
(this._scheduler || rootTimers).scheduling.clearInterval(this._id);
|
|
482
|
+
this._id = null;
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
reset() {
|
|
487
|
+
this.stop();
|
|
488
|
+
this.currentCount = 0;
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
export var nextMovieTimerId = 0;
|
|
493
|
+
export function createMovieTimers() {
|
|
494
|
+
var pending = new Map(), stopped = false;
|
|
495
|
+
function clear(id) {
|
|
496
|
+
var task = pending.get(id);
|
|
497
|
+
if (!task) return;
|
|
498
|
+
pending.delete(id);
|
|
499
|
+
if (task.repeat) clearInterval(task.handle);
|
|
500
|
+
else clearTimeout(task.handle);
|
|
501
|
+
if (task.onCancel) task.onCancel();
|
|
502
|
+
}
|
|
503
|
+
function schedule(repeat, callback, delay, args, onCancel) {
|
|
504
|
+
if (stopped) return 0;
|
|
505
|
+
if (typeof callback !== 'function') throw new TypeError('A timer callback must be a function');
|
|
506
|
+
var id = ++nextMovieTimerId;
|
|
507
|
+
var task = { repeat: repeat, onCancel: onCancel };
|
|
508
|
+
function fire() {
|
|
509
|
+
if (!pending.has(id)) return;
|
|
510
|
+
if (!repeat) pending.delete(id);
|
|
511
|
+
callback.apply(null, args);
|
|
512
|
+
}
|
|
513
|
+
task.handle = repeat ? setInterval(fire, delay) : setTimeout(fire, delay);
|
|
514
|
+
pending.set(id, task);
|
|
515
|
+
return id;
|
|
516
|
+
}
|
|
517
|
+
var scheduling = {
|
|
518
|
+
setInterval: function (callback, delay) { return schedule(true, callback, delay, Array.prototype.slice.call(arguments, 2)); },
|
|
519
|
+
setTimeout: function (callback, delay) { return schedule(false, callback, delay, Array.prototype.slice.call(arguments, 2)); },
|
|
520
|
+
clearInterval: clear,
|
|
521
|
+
clearTimeout: clear,
|
|
522
|
+
};
|
|
523
|
+
class MovieTimer extends Timer {
|
|
524
|
+
constructor(delay, repeatCount) {
|
|
525
|
+
super(delay, repeatCount);
|
|
526
|
+
this._scheduler = scope;
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
Object.defineProperty(MovieTimer, Symbol.hasInstance, { value: function (value) {
|
|
530
|
+
return Function.prototype[Symbol.hasInstance].call(this === MovieTimer ? Timer : this, value);
|
|
531
|
+
} });
|
|
532
|
+
MovieTimer.__swoofQualifiedName = 'flash.utils.Timer';
|
|
533
|
+
var scope = {
|
|
534
|
+
Timer: MovieTimer, scheduling: scheduling,
|
|
535
|
+
stopAll: function () {
|
|
536
|
+
stopped = true;
|
|
537
|
+
for (var id of pending.keys()) clear(id);
|
|
538
|
+
},
|
|
539
|
+
startTimer: function (timer, fire, onCancel) {
|
|
540
|
+
return schedule(true, fire, Math.max(1, timer.delay | 0), [], onCancel);
|
|
541
|
+
},
|
|
542
|
+
};
|
|
543
|
+
return scope;
|
|
544
|
+
}
|
|
545
|
+
export var rootTimers = createMovieTimers();
|
|
546
|
+
|
|
547
|
+
export class MouseEvent extends Event {
|
|
548
|
+
static CLICK = 'click';
|
|
549
|
+
static DOUBLE_CLICK = 'doubleClick';
|
|
550
|
+
static MOUSE_DOWN = 'mouseDown';
|
|
551
|
+
static MOUSE_UP = 'mouseUp';
|
|
552
|
+
static MIDDLE_MOUSE_DOWN = 'middleMouseDown';
|
|
553
|
+
static MIDDLE_MOUSE_UP = 'middleMouseUp';
|
|
554
|
+
static MIDDLE_CLICK = 'middleClick';
|
|
555
|
+
static RIGHT_MOUSE_DOWN = 'rightMouseDown';
|
|
556
|
+
static RIGHT_MOUSE_UP = 'rightMouseUp';
|
|
557
|
+
static RIGHT_CLICK = 'rightClick';
|
|
558
|
+
static MOUSE_WHEEL = 'mouseWheel';
|
|
559
|
+
/** AIR 51+ horizontal wheel / trackpad tilt. */
|
|
560
|
+
static MOUSE_WHEEL_HORIZONTAL = 'mouseWheelHorizontal';
|
|
561
|
+
static MOUSE_MOVE = 'mouseMove';
|
|
562
|
+
static MOUSE_OVER = 'mouseOver';
|
|
563
|
+
static MOUSE_OUT = 'mouseOut';
|
|
564
|
+
static RELEASE_OUTSIDE = 'releaseOutside';
|
|
565
|
+
static ROLL_OVER = 'rollOver';
|
|
566
|
+
static ROLL_OUT = 'rollOut';
|
|
567
|
+
|
|
568
|
+
constructor(type, bubbles, cancelable, localX, localY, relatedObject, ctrlKey, altKey, shiftKey, buttonDown, delta, commandKey, controlKey, clickCount) {
|
|
569
|
+
super(type || 'mouseEvent', bubbles === undefined ? true : bubbles, cancelable);
|
|
570
|
+
this.localX = localX === undefined ? 0 : +localX;
|
|
571
|
+
this.localY = localY === undefined ? 0 : +localY;
|
|
572
|
+
this.relatedObject = relatedObject || null;
|
|
573
|
+
this.ctrlKey = !!ctrlKey;
|
|
574
|
+
this.altKey = !!altKey;
|
|
575
|
+
this.shiftKey = !!shiftKey;
|
|
576
|
+
this.buttonDown = !!buttonDown;
|
|
577
|
+
this.delta = delta | 0;
|
|
578
|
+
this.commandKey = !!commandKey;
|
|
579
|
+
this.controlKey = !!controlKey;
|
|
580
|
+
this.clickCount = clickCount | 0;
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
clone() {
|
|
584
|
+
var copy = new MouseEvent(this.type, this.bubbles, this.cancelable, this.localX, this.localY,
|
|
585
|
+
this.relatedObject, this.ctrlKey, this.altKey, this.shiftKey, this.buttonDown, this.delta,
|
|
586
|
+
this.commandKey, this.controlKey, this.clickCount);
|
|
587
|
+
copy.stageX = this.stageX;
|
|
588
|
+
copy.stageY = this.stageY;
|
|
589
|
+
return copy;
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
export class TouchEventIntent {
|
|
594
|
+
static UNKNOWN = 'unknown';
|
|
595
|
+
static PEN = 'pen';
|
|
596
|
+
static ERASER = 'eraser';
|
|
597
|
+
}
|
|
598
|
+
export function touchStagePoint(event) {
|
|
599
|
+
return event._stagePoint || event.target?.localToGlobal?.(new Point(event.localX, event.localY));
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
export class TouchEvent extends Event {
|
|
603
|
+
static TOUCH_BEGIN = 'touchBegin';
|
|
604
|
+
static TOUCH_MOVE = 'touchMove';
|
|
605
|
+
static TOUCH_END = 'touchEnd';
|
|
606
|
+
static TOUCH_OUT = 'touchOut';
|
|
607
|
+
static TOUCH_OVER = 'touchOver';
|
|
608
|
+
static TOUCH_TAP = 'touchTap';
|
|
609
|
+
static TOUCH_ROLL_OUT = 'touchRollOut';
|
|
610
|
+
static TOUCH_ROLL_OVER = 'touchRollOver';
|
|
611
|
+
/** AIR stylus hover — browser pen pointers with buttons=0 while Multitouch is TOUCH_POINT. */
|
|
612
|
+
static PROXIMITY_BEGIN = 'proximityBegin';
|
|
613
|
+
static PROXIMITY_END = 'proximityEnd';
|
|
614
|
+
static PROXIMITY_MOVE = 'proximityMove';
|
|
615
|
+
static PROXIMITY_OUT = 'proximityOut';
|
|
616
|
+
static PROXIMITY_OVER = 'proximityOver';
|
|
617
|
+
|
|
618
|
+
constructor(type, bubbles, cancelable, touchPointID, primary, localX, localY, sizeX, sizeY,
|
|
619
|
+
pressure, relatedObject, ctrlKey, altKey, shiftKey, commandKey, controlKey,
|
|
620
|
+
timestamp, touchIntent, samples, canceled) {
|
|
621
|
+
super(type, bubbles === undefined ? true : bubbles, cancelable);
|
|
622
|
+
this.touchPointID = touchPointID | 0;
|
|
623
|
+
this.isPrimaryTouchPoint = !!primary;
|
|
624
|
+
this.localX = Number(localX);
|
|
625
|
+
this.localY = Number(localY);
|
|
626
|
+
this.sizeX = Number(sizeX);
|
|
627
|
+
this.sizeY = Number(sizeY);
|
|
628
|
+
this.pressure = Number(pressure);
|
|
629
|
+
this.relatedObject = relatedObject || null;
|
|
630
|
+
this.ctrlKey = !!ctrlKey;
|
|
631
|
+
this.altKey = !!altKey;
|
|
632
|
+
this.shiftKey = !!shiftKey;
|
|
633
|
+
this.commandKey = !!commandKey;
|
|
634
|
+
this.controlKey = !!controlKey;
|
|
635
|
+
this.timestamp = Number(timestamp);
|
|
636
|
+
this.touchIntent = touchIntent == null ? TouchEventIntent.UNKNOWN : String(touchIntent);
|
|
637
|
+
this.isTouchPointCanceled = !!canceled;
|
|
638
|
+
if (samples instanceof ByteArray) {
|
|
639
|
+
var bytes = samples._getU8();
|
|
640
|
+
var view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
641
|
+
var values = new Float32Array(Math.floor(bytes.length / 12) * 3);
|
|
642
|
+
for (var i = 0; i < values.length; i++) values[i] = view.getFloat32(i * 4, samples.endian === Endian.LITTLE_ENDIAN);
|
|
643
|
+
this._touchSamples = values;
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
get stageX() { return touchStagePoint(this)?.x ?? this.localX; }
|
|
648
|
+
get stageY() { return touchStagePoint(this)?.y ?? this.localY; }
|
|
649
|
+
|
|
650
|
+
getSamples(buffer, append) {
|
|
651
|
+
if (!(buffer instanceof ByteArray)) throw new TypeError('Expected a ByteArray for touch samples');
|
|
652
|
+
if (!append) buffer.clear();
|
|
653
|
+
var values = this._touchSamples;
|
|
654
|
+
if (!values) return 0;
|
|
655
|
+
for (var value of values) buffer.writeFloat(value);
|
|
656
|
+
return values.length / 3;
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
clone() {
|
|
660
|
+
var clone = new TouchEvent(this.type, this.bubbles, this.cancelable, this.touchPointID, this.isPrimaryTouchPoint,
|
|
661
|
+
this.localX, this.localY, this.sizeX, this.sizeY, this.pressure, this.relatedObject, this.ctrlKey,
|
|
662
|
+
this.altKey, this.shiftKey, this.commandKey, this.controlKey, this.timestamp, this.touchIntent,
|
|
663
|
+
null, this.isTouchPointCanceled);
|
|
664
|
+
clone._stagePoint = this._stagePoint;
|
|
665
|
+
if (this._touchSamples) clone._touchSamples = this._touchSamples.slice();
|
|
666
|
+
return clone;
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
export class GesturePhase {
|
|
671
|
+
static BEGIN = 'begin';
|
|
672
|
+
static UPDATE = 'update';
|
|
673
|
+
static END = 'end';
|
|
674
|
+
static ALL = 'all';
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
export class GestureEvent extends Event {
|
|
678
|
+
static GESTURE_TWO_FINGER_TAP = 'gestureTwoFingerTap';
|
|
679
|
+
|
|
680
|
+
constructor(type, bubbles, cancelable, phase, localX, localY, ctrlKey, altKey, shiftKey, commandKey, controlKey) {
|
|
681
|
+
super(type, bubbles === undefined ? true : bubbles, cancelable);
|
|
682
|
+
this.phase = phase == null ? null : String(phase);
|
|
683
|
+
this.localX = localX === undefined ? 0 : Number(localX);
|
|
684
|
+
this.localY = localY === undefined ? 0 : Number(localY);
|
|
685
|
+
this.ctrlKey = !!ctrlKey;
|
|
686
|
+
this.altKey = !!altKey;
|
|
687
|
+
this.shiftKey = !!shiftKey;
|
|
688
|
+
this.commandKey = !!commandKey;
|
|
689
|
+
this.controlKey = !!controlKey;
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
get stageX() { return touchStagePoint(this)?.x ?? this.localX; }
|
|
693
|
+
get stageY() { return touchStagePoint(this)?.y ?? this.localY; }
|
|
694
|
+
|
|
695
|
+
clone() {
|
|
696
|
+
var clone = new GestureEvent(this.type, this.bubbles, this.cancelable, this.phase, this.localX, this.localY,
|
|
697
|
+
this.ctrlKey, this.altKey, this.shiftKey, this.commandKey, this.controlKey);
|
|
698
|
+
clone._stagePoint = this._stagePoint;
|
|
699
|
+
return clone;
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
export class TransformGestureEvent extends GestureEvent {
|
|
704
|
+
static GESTURE_PAN = 'gesturePan';
|
|
705
|
+
static GESTURE_ZOOM = 'gestureZoom';
|
|
706
|
+
static GESTURE_ROTATE = 'gestureRotate';
|
|
707
|
+
static GESTURE_SWIPE = 'gestureSwipe';
|
|
708
|
+
|
|
709
|
+
constructor(type, bubbles, cancelable, phase, localX, localY, scaleX, scaleY,
|
|
710
|
+
rotation, offsetX, offsetY, ctrlKey, altKey, shiftKey, commandKey, controlKey, velocity) {
|
|
711
|
+
super(type, bubbles, cancelable, phase, localX, localY, ctrlKey, altKey, shiftKey, commandKey, controlKey);
|
|
712
|
+
this.scaleX = scaleX === undefined ? 1 : Number(scaleX);
|
|
713
|
+
this.scaleY = scaleY === undefined ? 1 : Number(scaleY);
|
|
714
|
+
this.rotation = rotation === undefined ? 0 : Number(rotation);
|
|
715
|
+
this.offsetX = offsetX === undefined ? 0 : Number(offsetX);
|
|
716
|
+
this.offsetY = offsetY === undefined ? 0 : Number(offsetY);
|
|
717
|
+
this.velocity = velocity === undefined ? 0 : Number(velocity);
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
clone() {
|
|
721
|
+
var clone = new TransformGestureEvent(this.type, this.bubbles, this.cancelable, this.phase, this.localX, this.localY,
|
|
722
|
+
this.scaleX, this.scaleY, this.rotation, this.offsetX, this.offsetY, this.ctrlKey, this.altKey,
|
|
723
|
+
this.shiftKey, this.commandKey, this.controlKey, this.velocity);
|
|
724
|
+
clone._stagePoint = this._stagePoint;
|
|
725
|
+
return clone;
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
export function tapGestureStagePoint(event) {
|
|
730
|
+
return event._tapStagePoint || event.target?.localToGlobal?.(new Point(event.tapLocalX, event.tapLocalY));
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
export class PressAndTapGestureEvent extends GestureEvent {
|
|
734
|
+
static GESTURE_PRESS_AND_TAP = 'gesturePressAndTap';
|
|
735
|
+
|
|
736
|
+
constructor(type, bubbles, cancelable, phase, localX, localY, tapLocalX, tapLocalY,
|
|
737
|
+
ctrlKey, altKey, shiftKey, commandKey, controlKey) {
|
|
738
|
+
super(type, bubbles, cancelable, phase, localX, localY, ctrlKey, altKey, shiftKey, commandKey, controlKey);
|
|
739
|
+
this.tapLocalX = tapLocalX === undefined ? 0 : Number(tapLocalX);
|
|
740
|
+
this.tapLocalY = tapLocalY === undefined ? 0 : Number(tapLocalY);
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
get tapStageX() { return tapGestureStagePoint(this)?.x ?? this.tapLocalX; }
|
|
744
|
+
get tapStageY() { return tapGestureStagePoint(this)?.y ?? this.tapLocalY; }
|
|
745
|
+
|
|
746
|
+
clone() {
|
|
747
|
+
var clone = new PressAndTapGestureEvent(this.type, this.bubbles, this.cancelable, this.phase, this.localX, this.localY,
|
|
748
|
+
this.tapLocalX, this.tapLocalY, this.ctrlKey, this.altKey, this.shiftKey, this.commandKey, this.controlKey);
|
|
749
|
+
clone._stagePoint = this._stagePoint;
|
|
750
|
+
clone._tapStagePoint = this._tapStagePoint;
|
|
751
|
+
return clone;
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
|