melonjs 10.6.0 → 10.7.1
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/dist/melonjs.js +37468 -36530
- package/dist/melonjs.min.js +21 -21
- package/dist/melonjs.module.d.ts +369 -164
- package/dist/melonjs.module.js +1750 -793
- package/package.json +10 -8
- package/src/game.js +5 -5
- package/src/geometries/rectangle.js +15 -0
- package/src/index.js +4 -4
- package/src/input/gamepad.js +12 -10
- package/src/input/keyboard.js +5 -3
- package/src/input/pointer.js +1 -1
- package/src/input/pointerevent.js +2 -3
- package/src/level/tiled/TMXUtils.js +1 -1
- package/src/loader/loader.js +1 -1
- package/src/math/matrix3.js +66 -65
- package/src/particles/emitter.js +119 -428
- package/src/particles/particle.js +51 -52
- package/src/particles/settings.js +310 -0
- package/src/polyfill/console.js +7 -7
- package/src/polyfill/index.js +7 -0
- package/src/polyfill/performance.js +20 -0
- package/src/polyfill/requestAnimationFrame.js +10 -10
- package/src/renderable/imagelayer.js +2 -2
- package/src/state/state.js +7 -7
- package/src/system/device.js +141 -128
- package/src/system/event.js +10 -10
- package/src/system/timer.js +1 -1
- package/src/text/bitmaptext.js +5 -5
- package/src/utils/agent.js +4 -4
- package/src/utils/function.js +2 -2
- package/src/utils/utils.js +10 -5
- package/src/video/canvas/canvas_renderer.js +15 -2
- package/src/video/renderer.js +2 -2
- package/src/video/video.js +11 -11
- package/src/video/webgl/glshader.js +1 -1
- package/src/video/webgl/webgl_renderer.js +6 -5
- package/src/particles/particlecontainer.js +0 -95
package/dist/melonjs.module.js
CHANGED
|
@@ -1,22 +1,1022 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* melonJS Game Engine - v10.
|
|
2
|
+
* melonJS Game Engine - v10.7.1
|
|
3
3
|
* http://www.melonjs.org
|
|
4
4
|
* melonjs is licensed under the MIT License.
|
|
5
5
|
* http://www.opensource.org/licenses/mit-license
|
|
6
6
|
* @copyright (C) 2011 - 2022 Olivier Biot
|
|
7
7
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
9
|
+
|
|
10
|
+
var check = function (it) {
|
|
11
|
+
return it && it.Math == Math && it;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
|
|
15
|
+
var global$m =
|
|
16
|
+
// eslint-disable-next-line es-x/no-global-this -- safe
|
|
17
|
+
check(typeof globalThis == 'object' && globalThis) ||
|
|
18
|
+
check(typeof window == 'object' && window) ||
|
|
19
|
+
// eslint-disable-next-line no-restricted-globals -- safe
|
|
20
|
+
check(typeof self == 'object' && self) ||
|
|
21
|
+
check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
|
|
22
|
+
// eslint-disable-next-line no-new-func -- fallback
|
|
23
|
+
(function () { return this; })() || Function('return this')();
|
|
24
|
+
|
|
25
|
+
var objectGetOwnPropertyDescriptor = {};
|
|
26
|
+
|
|
27
|
+
var fails$8 = function (exec) {
|
|
28
|
+
try {
|
|
29
|
+
return !!exec();
|
|
30
|
+
} catch (error) {
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
var fails$7 = fails$8;
|
|
36
|
+
|
|
37
|
+
// Detect IE8's incomplete defineProperty implementation
|
|
38
|
+
var descriptors = !fails$7(function () {
|
|
39
|
+
// eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
|
|
40
|
+
return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
var fails$6 = fails$8;
|
|
44
|
+
|
|
45
|
+
var functionBindNative = !fails$6(function () {
|
|
46
|
+
// eslint-disable-next-line es-x/no-function-prototype-bind -- safe
|
|
47
|
+
var test = (function () { /* empty */ }).bind();
|
|
48
|
+
// eslint-disable-next-line no-prototype-builtins -- safe
|
|
49
|
+
return typeof test != 'function' || test.hasOwnProperty('prototype');
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
var NATIVE_BIND$1 = functionBindNative;
|
|
53
|
+
|
|
54
|
+
var call$4 = Function.prototype.call;
|
|
55
|
+
|
|
56
|
+
var functionCall = NATIVE_BIND$1 ? call$4.bind(call$4) : function () {
|
|
57
|
+
return call$4.apply(call$4, arguments);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
var objectPropertyIsEnumerable = {};
|
|
61
|
+
|
|
62
|
+
var $propertyIsEnumerable = {}.propertyIsEnumerable;
|
|
63
|
+
// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
|
|
64
|
+
var getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
|
|
65
|
+
|
|
66
|
+
// Nashorn ~ JDK8 bug
|
|
67
|
+
var NASHORN_BUG = getOwnPropertyDescriptor$1 && !$propertyIsEnumerable.call({ 1: 2 }, 1);
|
|
68
|
+
|
|
69
|
+
// `Object.prototype.propertyIsEnumerable` method implementation
|
|
70
|
+
// https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
|
|
71
|
+
objectPropertyIsEnumerable.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
|
|
72
|
+
var descriptor = getOwnPropertyDescriptor$1(this, V);
|
|
73
|
+
return !!descriptor && descriptor.enumerable;
|
|
74
|
+
} : $propertyIsEnumerable;
|
|
75
|
+
|
|
76
|
+
var createPropertyDescriptor$2 = function (bitmap, value) {
|
|
77
|
+
return {
|
|
78
|
+
enumerable: !(bitmap & 1),
|
|
79
|
+
configurable: !(bitmap & 2),
|
|
80
|
+
writable: !(bitmap & 4),
|
|
81
|
+
value: value
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
var NATIVE_BIND = functionBindNative;
|
|
86
|
+
|
|
87
|
+
var FunctionPrototype$1 = Function.prototype;
|
|
88
|
+
var bind = FunctionPrototype$1.bind;
|
|
89
|
+
var call$3 = FunctionPrototype$1.call;
|
|
90
|
+
var uncurryThis$9 = NATIVE_BIND && bind.bind(call$3, call$3);
|
|
91
|
+
|
|
92
|
+
var functionUncurryThis = NATIVE_BIND ? function (fn) {
|
|
93
|
+
return fn && uncurryThis$9(fn);
|
|
94
|
+
} : function (fn) {
|
|
95
|
+
return fn && function () {
|
|
96
|
+
return call$3.apply(fn, arguments);
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
var uncurryThis$8 = functionUncurryThis;
|
|
101
|
+
|
|
102
|
+
var toString$2 = uncurryThis$8({}.toString);
|
|
103
|
+
var stringSlice = uncurryThis$8(''.slice);
|
|
104
|
+
|
|
105
|
+
var classofRaw = function (it) {
|
|
106
|
+
return stringSlice(toString$2(it), 8, -1);
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
var global$l = global$m;
|
|
110
|
+
var uncurryThis$7 = functionUncurryThis;
|
|
111
|
+
var fails$5 = fails$8;
|
|
112
|
+
var classof = classofRaw;
|
|
113
|
+
|
|
114
|
+
var Object$3 = global$l.Object;
|
|
115
|
+
var split = uncurryThis$7(''.split);
|
|
116
|
+
|
|
117
|
+
// fallback for non-array-like ES3 and non-enumerable old V8 strings
|
|
118
|
+
var indexedObject = fails$5(function () {
|
|
119
|
+
// throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
|
|
120
|
+
// eslint-disable-next-line no-prototype-builtins -- safe
|
|
121
|
+
return !Object$3('z').propertyIsEnumerable(0);
|
|
122
|
+
}) ? function (it) {
|
|
123
|
+
return classof(it) == 'String' ? split(it, '') : Object$3(it);
|
|
124
|
+
} : Object$3;
|
|
125
|
+
|
|
126
|
+
var global$k = global$m;
|
|
127
|
+
|
|
128
|
+
var TypeError$7 = global$k.TypeError;
|
|
129
|
+
|
|
130
|
+
// `RequireObjectCoercible` abstract operation
|
|
131
|
+
// https://tc39.es/ecma262/#sec-requireobjectcoercible
|
|
132
|
+
var requireObjectCoercible$2 = function (it) {
|
|
133
|
+
if (it == undefined) throw TypeError$7("Can't call method on " + it);
|
|
134
|
+
return it;
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
// toObject with fallback for non-array-like ES3 strings
|
|
138
|
+
var IndexedObject = indexedObject;
|
|
139
|
+
var requireObjectCoercible$1 = requireObjectCoercible$2;
|
|
140
|
+
|
|
141
|
+
var toIndexedObject$3 = function (it) {
|
|
142
|
+
return IndexedObject(requireObjectCoercible$1(it));
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
// `IsCallable` abstract operation
|
|
146
|
+
// https://tc39.es/ecma262/#sec-iscallable
|
|
147
|
+
var isCallable$a = function (argument) {
|
|
148
|
+
return typeof argument == 'function';
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
var isCallable$9 = isCallable$a;
|
|
152
|
+
|
|
153
|
+
var isObject$5 = function (it) {
|
|
154
|
+
return typeof it == 'object' ? it !== null : isCallable$9(it);
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
var global$j = global$m;
|
|
158
|
+
var isCallable$8 = isCallable$a;
|
|
159
|
+
|
|
160
|
+
var aFunction = function (argument) {
|
|
161
|
+
return isCallable$8(argument) ? argument : undefined;
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
var getBuiltIn$3 = function (namespace, method) {
|
|
165
|
+
return arguments.length < 2 ? aFunction(global$j[namespace]) : global$j[namespace] && global$j[namespace][method];
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
var uncurryThis$6 = functionUncurryThis;
|
|
169
|
+
|
|
170
|
+
var objectIsPrototypeOf = uncurryThis$6({}.isPrototypeOf);
|
|
171
|
+
|
|
172
|
+
var getBuiltIn$2 = getBuiltIn$3;
|
|
173
|
+
|
|
174
|
+
var engineUserAgent = getBuiltIn$2('navigator', 'userAgent') || '';
|
|
175
|
+
|
|
176
|
+
var global$i = global$m;
|
|
177
|
+
var userAgent = engineUserAgent;
|
|
178
|
+
|
|
179
|
+
var process$1 = global$i.process;
|
|
180
|
+
var Deno = global$i.Deno;
|
|
181
|
+
var versions = process$1 && process$1.versions || Deno && Deno.version;
|
|
182
|
+
var v8 = versions && versions.v8;
|
|
183
|
+
var match, version$1;
|
|
184
|
+
|
|
185
|
+
if (v8) {
|
|
186
|
+
match = v8.split('.');
|
|
187
|
+
// in old Chrome, versions of V8 isn't V8 = Chrome / 10
|
|
188
|
+
// but their correct versions are not interesting for us
|
|
189
|
+
version$1 = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`
|
|
193
|
+
// so check `userAgent` even if `.v8` exists, but 0
|
|
194
|
+
if (!version$1 && userAgent) {
|
|
195
|
+
match = userAgent.match(/Edge\/(\d+)/);
|
|
196
|
+
if (!match || match[1] >= 74) {
|
|
197
|
+
match = userAgent.match(/Chrome\/(\d+)/);
|
|
198
|
+
if (match) version$1 = +match[1];
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
var engineV8Version = version$1;
|
|
203
|
+
|
|
204
|
+
/* eslint-disable es-x/no-symbol -- required for testing */
|
|
205
|
+
|
|
206
|
+
var V8_VERSION = engineV8Version;
|
|
207
|
+
var fails$4 = fails$8;
|
|
208
|
+
|
|
209
|
+
// eslint-disable-next-line es-x/no-object-getownpropertysymbols -- required for testing
|
|
210
|
+
var nativeSymbol = !!Object.getOwnPropertySymbols && !fails$4(function () {
|
|
211
|
+
var symbol = Symbol();
|
|
212
|
+
// Chrome 38 Symbol has incorrect toString conversion
|
|
213
|
+
// `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
|
|
214
|
+
return !String(symbol) || !(Object(symbol) instanceof Symbol) ||
|
|
215
|
+
// Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
|
|
216
|
+
!Symbol.sham && V8_VERSION && V8_VERSION < 41;
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
/* eslint-disable es-x/no-symbol -- required for testing */
|
|
220
|
+
|
|
221
|
+
var NATIVE_SYMBOL$1 = nativeSymbol;
|
|
222
|
+
|
|
223
|
+
var useSymbolAsUid = NATIVE_SYMBOL$1
|
|
224
|
+
&& !Symbol.sham
|
|
225
|
+
&& typeof Symbol.iterator == 'symbol';
|
|
226
|
+
|
|
227
|
+
var global$h = global$m;
|
|
228
|
+
var getBuiltIn$1 = getBuiltIn$3;
|
|
229
|
+
var isCallable$7 = isCallable$a;
|
|
230
|
+
var isPrototypeOf = objectIsPrototypeOf;
|
|
231
|
+
var USE_SYMBOL_AS_UID$1 = useSymbolAsUid;
|
|
232
|
+
|
|
233
|
+
var Object$2 = global$h.Object;
|
|
234
|
+
|
|
235
|
+
var isSymbol$2 = USE_SYMBOL_AS_UID$1 ? function (it) {
|
|
236
|
+
return typeof it == 'symbol';
|
|
237
|
+
} : function (it) {
|
|
238
|
+
var $Symbol = getBuiltIn$1('Symbol');
|
|
239
|
+
return isCallable$7($Symbol) && isPrototypeOf($Symbol.prototype, Object$2(it));
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
var global$g = global$m;
|
|
243
|
+
|
|
244
|
+
var String$2 = global$g.String;
|
|
245
|
+
|
|
246
|
+
var tryToString$1 = function (argument) {
|
|
247
|
+
try {
|
|
248
|
+
return String$2(argument);
|
|
249
|
+
} catch (error) {
|
|
250
|
+
return 'Object';
|
|
251
|
+
}
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
var global$f = global$m;
|
|
255
|
+
var isCallable$6 = isCallable$a;
|
|
256
|
+
var tryToString = tryToString$1;
|
|
257
|
+
|
|
258
|
+
var TypeError$6 = global$f.TypeError;
|
|
259
|
+
|
|
260
|
+
// `Assert: IsCallable(argument) is true`
|
|
261
|
+
var aCallable$1 = function (argument) {
|
|
262
|
+
if (isCallable$6(argument)) return argument;
|
|
263
|
+
throw TypeError$6(tryToString(argument) + ' is not a function');
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
var aCallable = aCallable$1;
|
|
267
|
+
|
|
268
|
+
// `GetMethod` abstract operation
|
|
269
|
+
// https://tc39.es/ecma262/#sec-getmethod
|
|
270
|
+
var getMethod$1 = function (V, P) {
|
|
271
|
+
var func = V[P];
|
|
272
|
+
return func == null ? undefined : aCallable(func);
|
|
273
|
+
};
|
|
274
|
+
|
|
275
|
+
var global$e = global$m;
|
|
276
|
+
var call$2 = functionCall;
|
|
277
|
+
var isCallable$5 = isCallable$a;
|
|
278
|
+
var isObject$4 = isObject$5;
|
|
279
|
+
|
|
280
|
+
var TypeError$5 = global$e.TypeError;
|
|
281
|
+
|
|
282
|
+
// `OrdinaryToPrimitive` abstract operation
|
|
283
|
+
// https://tc39.es/ecma262/#sec-ordinarytoprimitive
|
|
284
|
+
var ordinaryToPrimitive$1 = function (input, pref) {
|
|
285
|
+
var fn, val;
|
|
286
|
+
if (pref === 'string' && isCallable$5(fn = input.toString) && !isObject$4(val = call$2(fn, input))) return val;
|
|
287
|
+
if (isCallable$5(fn = input.valueOf) && !isObject$4(val = call$2(fn, input))) return val;
|
|
288
|
+
if (pref !== 'string' && isCallable$5(fn = input.toString) && !isObject$4(val = call$2(fn, input))) return val;
|
|
289
|
+
throw TypeError$5("Can't convert object to primitive value");
|
|
290
|
+
};
|
|
291
|
+
|
|
292
|
+
var shared$3 = {exports: {}};
|
|
293
|
+
|
|
294
|
+
var global$d = global$m;
|
|
295
|
+
|
|
296
|
+
// eslint-disable-next-line es-x/no-object-defineproperty -- safe
|
|
297
|
+
var defineProperty$1 = Object.defineProperty;
|
|
298
|
+
|
|
299
|
+
var setGlobal$3 = function (key, value) {
|
|
300
|
+
try {
|
|
301
|
+
defineProperty$1(global$d, key, { value: value, configurable: true, writable: true });
|
|
302
|
+
} catch (error) {
|
|
303
|
+
global$d[key] = value;
|
|
304
|
+
} return value;
|
|
305
|
+
};
|
|
306
|
+
|
|
307
|
+
var global$c = global$m;
|
|
308
|
+
var setGlobal$2 = setGlobal$3;
|
|
309
|
+
|
|
310
|
+
var SHARED = '__core-js_shared__';
|
|
311
|
+
var store$3 = global$c[SHARED] || setGlobal$2(SHARED, {});
|
|
312
|
+
|
|
313
|
+
var sharedStore = store$3;
|
|
314
|
+
|
|
315
|
+
var store$2 = sharedStore;
|
|
316
|
+
|
|
317
|
+
(shared$3.exports = function (key, value) {
|
|
318
|
+
return store$2[key] || (store$2[key] = value !== undefined ? value : {});
|
|
319
|
+
})('versions', []).push({
|
|
320
|
+
version: '3.22.4',
|
|
321
|
+
mode: 'global',
|
|
322
|
+
copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',
|
|
323
|
+
license: 'https://github.com/zloirock/core-js/blob/v3.22.4/LICENSE',
|
|
324
|
+
source: 'https://github.com/zloirock/core-js'
|
|
325
|
+
});
|
|
326
|
+
|
|
327
|
+
var global$b = global$m;
|
|
328
|
+
var requireObjectCoercible = requireObjectCoercible$2;
|
|
329
|
+
|
|
330
|
+
var Object$1 = global$b.Object;
|
|
331
|
+
|
|
332
|
+
// `ToObject` abstract operation
|
|
333
|
+
// https://tc39.es/ecma262/#sec-toobject
|
|
334
|
+
var toObject$1 = function (argument) {
|
|
335
|
+
return Object$1(requireObjectCoercible(argument));
|
|
336
|
+
};
|
|
337
|
+
|
|
338
|
+
var uncurryThis$5 = functionUncurryThis;
|
|
339
|
+
var toObject = toObject$1;
|
|
340
|
+
|
|
341
|
+
var hasOwnProperty = uncurryThis$5({}.hasOwnProperty);
|
|
342
|
+
|
|
343
|
+
// `HasOwnProperty` abstract operation
|
|
344
|
+
// https://tc39.es/ecma262/#sec-hasownproperty
|
|
345
|
+
// eslint-disable-next-line es-x/no-object-hasown -- safe
|
|
346
|
+
var hasOwnProperty_1 = Object.hasOwn || function hasOwn(it, key) {
|
|
347
|
+
return hasOwnProperty(toObject(it), key);
|
|
348
|
+
};
|
|
349
|
+
|
|
350
|
+
var uncurryThis$4 = functionUncurryThis;
|
|
351
|
+
|
|
352
|
+
var id = 0;
|
|
353
|
+
var postfix = Math.random();
|
|
354
|
+
var toString$1 = uncurryThis$4(1.0.toString);
|
|
355
|
+
|
|
356
|
+
var uid$2 = function (key) {
|
|
357
|
+
return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString$1(++id + postfix, 36);
|
|
358
|
+
};
|
|
359
|
+
|
|
360
|
+
var global$a = global$m;
|
|
361
|
+
var shared$2 = shared$3.exports;
|
|
362
|
+
var hasOwn$6 = hasOwnProperty_1;
|
|
363
|
+
var uid$1 = uid$2;
|
|
364
|
+
var NATIVE_SYMBOL = nativeSymbol;
|
|
365
|
+
var USE_SYMBOL_AS_UID = useSymbolAsUid;
|
|
366
|
+
|
|
367
|
+
var WellKnownSymbolsStore = shared$2('wks');
|
|
368
|
+
var Symbol$1 = global$a.Symbol;
|
|
369
|
+
var symbolFor = Symbol$1 && Symbol$1['for'];
|
|
370
|
+
var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid$1;
|
|
371
|
+
|
|
372
|
+
var wellKnownSymbol$1 = function (name) {
|
|
373
|
+
if (!hasOwn$6(WellKnownSymbolsStore, name) || !(NATIVE_SYMBOL || typeof WellKnownSymbolsStore[name] == 'string')) {
|
|
374
|
+
var description = 'Symbol.' + name;
|
|
375
|
+
if (NATIVE_SYMBOL && hasOwn$6(Symbol$1, name)) {
|
|
376
|
+
WellKnownSymbolsStore[name] = Symbol$1[name];
|
|
377
|
+
} else if (USE_SYMBOL_AS_UID && symbolFor) {
|
|
378
|
+
WellKnownSymbolsStore[name] = symbolFor(description);
|
|
379
|
+
} else {
|
|
380
|
+
WellKnownSymbolsStore[name] = createWellKnownSymbol(description);
|
|
381
|
+
}
|
|
382
|
+
} return WellKnownSymbolsStore[name];
|
|
383
|
+
};
|
|
384
|
+
|
|
385
|
+
var global$9 = global$m;
|
|
386
|
+
var call$1 = functionCall;
|
|
387
|
+
var isObject$3 = isObject$5;
|
|
388
|
+
var isSymbol$1 = isSymbol$2;
|
|
389
|
+
var getMethod = getMethod$1;
|
|
390
|
+
var ordinaryToPrimitive = ordinaryToPrimitive$1;
|
|
391
|
+
var wellKnownSymbol = wellKnownSymbol$1;
|
|
392
|
+
|
|
393
|
+
var TypeError$4 = global$9.TypeError;
|
|
394
|
+
var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
|
|
395
|
+
|
|
396
|
+
// `ToPrimitive` abstract operation
|
|
397
|
+
// https://tc39.es/ecma262/#sec-toprimitive
|
|
398
|
+
var toPrimitive$1 = function (input, pref) {
|
|
399
|
+
if (!isObject$3(input) || isSymbol$1(input)) return input;
|
|
400
|
+
var exoticToPrim = getMethod(input, TO_PRIMITIVE);
|
|
401
|
+
var result;
|
|
402
|
+
if (exoticToPrim) {
|
|
403
|
+
if (pref === undefined) pref = 'default';
|
|
404
|
+
result = call$1(exoticToPrim, input, pref);
|
|
405
|
+
if (!isObject$3(result) || isSymbol$1(result)) return result;
|
|
406
|
+
throw TypeError$4("Can't convert object to primitive value");
|
|
407
|
+
}
|
|
408
|
+
if (pref === undefined) pref = 'number';
|
|
409
|
+
return ordinaryToPrimitive(input, pref);
|
|
410
|
+
};
|
|
411
|
+
|
|
412
|
+
var toPrimitive = toPrimitive$1;
|
|
413
|
+
var isSymbol = isSymbol$2;
|
|
414
|
+
|
|
415
|
+
// `ToPropertyKey` abstract operation
|
|
416
|
+
// https://tc39.es/ecma262/#sec-topropertykey
|
|
417
|
+
var toPropertyKey$2 = function (argument) {
|
|
418
|
+
var key = toPrimitive(argument, 'string');
|
|
419
|
+
return isSymbol(key) ? key : key + '';
|
|
420
|
+
};
|
|
421
|
+
|
|
422
|
+
var global$8 = global$m;
|
|
423
|
+
var isObject$2 = isObject$5;
|
|
424
|
+
|
|
425
|
+
var document$1 = global$8.document;
|
|
426
|
+
// typeof document.createElement is 'object' in old IE
|
|
427
|
+
var EXISTS$1 = isObject$2(document$1) && isObject$2(document$1.createElement);
|
|
428
|
+
|
|
429
|
+
var documentCreateElement = function (it) {
|
|
430
|
+
return EXISTS$1 ? document$1.createElement(it) : {};
|
|
431
|
+
};
|
|
432
|
+
|
|
433
|
+
var DESCRIPTORS$5 = descriptors;
|
|
434
|
+
var fails$3 = fails$8;
|
|
435
|
+
var createElement = documentCreateElement;
|
|
436
|
+
|
|
437
|
+
// Thanks to IE8 for its funny defineProperty
|
|
438
|
+
var ie8DomDefine = !DESCRIPTORS$5 && !fails$3(function () {
|
|
439
|
+
// eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
|
|
440
|
+
return Object.defineProperty(createElement('div'), 'a', {
|
|
441
|
+
get: function () { return 7; }
|
|
442
|
+
}).a != 7;
|
|
443
|
+
});
|
|
444
|
+
|
|
445
|
+
var DESCRIPTORS$4 = descriptors;
|
|
446
|
+
var call = functionCall;
|
|
447
|
+
var propertyIsEnumerableModule = objectPropertyIsEnumerable;
|
|
448
|
+
var createPropertyDescriptor$1 = createPropertyDescriptor$2;
|
|
449
|
+
var toIndexedObject$2 = toIndexedObject$3;
|
|
450
|
+
var toPropertyKey$1 = toPropertyKey$2;
|
|
451
|
+
var hasOwn$5 = hasOwnProperty_1;
|
|
452
|
+
var IE8_DOM_DEFINE$1 = ie8DomDefine;
|
|
453
|
+
|
|
454
|
+
// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
|
|
455
|
+
var $getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
|
|
456
|
+
|
|
457
|
+
// `Object.getOwnPropertyDescriptor` method
|
|
458
|
+
// https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
|
|
459
|
+
objectGetOwnPropertyDescriptor.f = DESCRIPTORS$4 ? $getOwnPropertyDescriptor$1 : function getOwnPropertyDescriptor(O, P) {
|
|
460
|
+
O = toIndexedObject$2(O);
|
|
461
|
+
P = toPropertyKey$1(P);
|
|
462
|
+
if (IE8_DOM_DEFINE$1) try {
|
|
463
|
+
return $getOwnPropertyDescriptor$1(O, P);
|
|
464
|
+
} catch (error) { /* empty */ }
|
|
465
|
+
if (hasOwn$5(O, P)) return createPropertyDescriptor$1(!call(propertyIsEnumerableModule.f, O, P), O[P]);
|
|
466
|
+
};
|
|
467
|
+
|
|
468
|
+
var objectDefineProperty = {};
|
|
469
|
+
|
|
470
|
+
var DESCRIPTORS$3 = descriptors;
|
|
471
|
+
var fails$2 = fails$8;
|
|
472
|
+
|
|
473
|
+
// V8 ~ Chrome 36-
|
|
474
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=3334
|
|
475
|
+
var v8PrototypeDefineBug = DESCRIPTORS$3 && fails$2(function () {
|
|
476
|
+
// eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
|
|
477
|
+
return Object.defineProperty(function () { /* empty */ }, 'prototype', {
|
|
478
|
+
value: 42,
|
|
479
|
+
writable: false
|
|
480
|
+
}).prototype != 42;
|
|
481
|
+
});
|
|
482
|
+
|
|
483
|
+
var global$7 = global$m;
|
|
484
|
+
var isObject$1 = isObject$5;
|
|
485
|
+
|
|
486
|
+
var String$1 = global$7.String;
|
|
487
|
+
var TypeError$3 = global$7.TypeError;
|
|
488
|
+
|
|
489
|
+
// `Assert: Type(argument) is Object`
|
|
490
|
+
var anObject$2 = function (argument) {
|
|
491
|
+
if (isObject$1(argument)) return argument;
|
|
492
|
+
throw TypeError$3(String$1(argument) + ' is not an object');
|
|
493
|
+
};
|
|
494
|
+
|
|
495
|
+
var global$6 = global$m;
|
|
496
|
+
var DESCRIPTORS$2 = descriptors;
|
|
497
|
+
var IE8_DOM_DEFINE = ie8DomDefine;
|
|
498
|
+
var V8_PROTOTYPE_DEFINE_BUG = v8PrototypeDefineBug;
|
|
499
|
+
var anObject$1 = anObject$2;
|
|
500
|
+
var toPropertyKey = toPropertyKey$2;
|
|
501
|
+
|
|
502
|
+
var TypeError$2 = global$6.TypeError;
|
|
503
|
+
// eslint-disable-next-line es-x/no-object-defineproperty -- safe
|
|
504
|
+
var $defineProperty = Object.defineProperty;
|
|
505
|
+
// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
|
|
506
|
+
var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
507
|
+
var ENUMERABLE = 'enumerable';
|
|
508
|
+
var CONFIGURABLE$1 = 'configurable';
|
|
509
|
+
var WRITABLE = 'writable';
|
|
510
|
+
|
|
511
|
+
// `Object.defineProperty` method
|
|
512
|
+
// https://tc39.es/ecma262/#sec-object.defineproperty
|
|
513
|
+
objectDefineProperty.f = DESCRIPTORS$2 ? V8_PROTOTYPE_DEFINE_BUG ? function defineProperty(O, P, Attributes) {
|
|
514
|
+
anObject$1(O);
|
|
515
|
+
P = toPropertyKey(P);
|
|
516
|
+
anObject$1(Attributes);
|
|
517
|
+
if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {
|
|
518
|
+
var current = $getOwnPropertyDescriptor(O, P);
|
|
519
|
+
if (current && current[WRITABLE]) {
|
|
520
|
+
O[P] = Attributes.value;
|
|
521
|
+
Attributes = {
|
|
522
|
+
configurable: CONFIGURABLE$1 in Attributes ? Attributes[CONFIGURABLE$1] : current[CONFIGURABLE$1],
|
|
523
|
+
enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE],
|
|
524
|
+
writable: false
|
|
525
|
+
};
|
|
526
|
+
}
|
|
527
|
+
} return $defineProperty(O, P, Attributes);
|
|
528
|
+
} : $defineProperty : function defineProperty(O, P, Attributes) {
|
|
529
|
+
anObject$1(O);
|
|
530
|
+
P = toPropertyKey(P);
|
|
531
|
+
anObject$1(Attributes);
|
|
532
|
+
if (IE8_DOM_DEFINE) try {
|
|
533
|
+
return $defineProperty(O, P, Attributes);
|
|
534
|
+
} catch (error) { /* empty */ }
|
|
535
|
+
if ('get' in Attributes || 'set' in Attributes) throw TypeError$2('Accessors not supported');
|
|
536
|
+
if ('value' in Attributes) O[P] = Attributes.value;
|
|
537
|
+
return O;
|
|
538
|
+
};
|
|
539
|
+
|
|
540
|
+
var DESCRIPTORS$1 = descriptors;
|
|
541
|
+
var definePropertyModule$1 = objectDefineProperty;
|
|
542
|
+
var createPropertyDescriptor = createPropertyDescriptor$2;
|
|
543
|
+
|
|
544
|
+
var createNonEnumerableProperty$3 = DESCRIPTORS$1 ? function (object, key, value) {
|
|
545
|
+
return definePropertyModule$1.f(object, key, createPropertyDescriptor(1, value));
|
|
546
|
+
} : function (object, key, value) {
|
|
547
|
+
object[key] = value;
|
|
548
|
+
return object;
|
|
549
|
+
};
|
|
550
|
+
|
|
551
|
+
var makeBuiltIn$2 = {exports: {}};
|
|
552
|
+
|
|
553
|
+
var DESCRIPTORS = descriptors;
|
|
554
|
+
var hasOwn$4 = hasOwnProperty_1;
|
|
555
|
+
|
|
556
|
+
var FunctionPrototype = Function.prototype;
|
|
557
|
+
// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
|
|
558
|
+
var getDescriptor = DESCRIPTORS && Object.getOwnPropertyDescriptor;
|
|
559
|
+
|
|
560
|
+
var EXISTS = hasOwn$4(FunctionPrototype, 'name');
|
|
561
|
+
// additional protection from minified / mangled / dropped function names
|
|
562
|
+
var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something';
|
|
563
|
+
var CONFIGURABLE = EXISTS && (!DESCRIPTORS || (DESCRIPTORS && getDescriptor(FunctionPrototype, 'name').configurable));
|
|
564
|
+
|
|
565
|
+
var functionName = {
|
|
566
|
+
EXISTS: EXISTS,
|
|
567
|
+
PROPER: PROPER,
|
|
568
|
+
CONFIGURABLE: CONFIGURABLE
|
|
569
|
+
};
|
|
570
|
+
|
|
571
|
+
var uncurryThis$3 = functionUncurryThis;
|
|
572
|
+
var isCallable$4 = isCallable$a;
|
|
573
|
+
var store$1 = sharedStore;
|
|
574
|
+
|
|
575
|
+
var functionToString = uncurryThis$3(Function.toString);
|
|
576
|
+
|
|
577
|
+
// this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
|
|
578
|
+
if (!isCallable$4(store$1.inspectSource)) {
|
|
579
|
+
store$1.inspectSource = function (it) {
|
|
580
|
+
return functionToString(it);
|
|
581
|
+
};
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
var inspectSource$2 = store$1.inspectSource;
|
|
585
|
+
|
|
586
|
+
var global$5 = global$m;
|
|
587
|
+
var isCallable$3 = isCallable$a;
|
|
588
|
+
var inspectSource$1 = inspectSource$2;
|
|
589
|
+
|
|
590
|
+
var WeakMap$1 = global$5.WeakMap;
|
|
591
|
+
|
|
592
|
+
var nativeWeakMap = isCallable$3(WeakMap$1) && /native code/.test(inspectSource$1(WeakMap$1));
|
|
593
|
+
|
|
594
|
+
var shared$1 = shared$3.exports;
|
|
595
|
+
var uid = uid$2;
|
|
596
|
+
|
|
597
|
+
var keys = shared$1('keys');
|
|
598
|
+
|
|
599
|
+
var sharedKey$1 = function (key) {
|
|
600
|
+
return keys[key] || (keys[key] = uid(key));
|
|
601
|
+
};
|
|
602
|
+
|
|
603
|
+
var hiddenKeys$3 = {};
|
|
604
|
+
|
|
605
|
+
var NATIVE_WEAK_MAP = nativeWeakMap;
|
|
606
|
+
var global$4 = global$m;
|
|
607
|
+
var uncurryThis$2 = functionUncurryThis;
|
|
608
|
+
var isObject = isObject$5;
|
|
609
|
+
var createNonEnumerableProperty$2 = createNonEnumerableProperty$3;
|
|
610
|
+
var hasOwn$3 = hasOwnProperty_1;
|
|
611
|
+
var shared = sharedStore;
|
|
612
|
+
var sharedKey = sharedKey$1;
|
|
613
|
+
var hiddenKeys$2 = hiddenKeys$3;
|
|
614
|
+
|
|
615
|
+
var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
|
|
616
|
+
var TypeError$1 = global$4.TypeError;
|
|
617
|
+
var WeakMap = global$4.WeakMap;
|
|
618
|
+
var set, get, has;
|
|
619
|
+
|
|
620
|
+
var enforce = function (it) {
|
|
621
|
+
return has(it) ? get(it) : set(it, {});
|
|
622
|
+
};
|
|
623
|
+
|
|
624
|
+
var getterFor = function (TYPE) {
|
|
625
|
+
return function (it) {
|
|
626
|
+
var state;
|
|
627
|
+
if (!isObject(it) || (state = get(it)).type !== TYPE) {
|
|
628
|
+
throw TypeError$1('Incompatible receiver, ' + TYPE + ' required');
|
|
629
|
+
} return state;
|
|
630
|
+
};
|
|
631
|
+
};
|
|
632
|
+
|
|
633
|
+
if (NATIVE_WEAK_MAP || shared.state) {
|
|
634
|
+
var store = shared.state || (shared.state = new WeakMap());
|
|
635
|
+
var wmget = uncurryThis$2(store.get);
|
|
636
|
+
var wmhas = uncurryThis$2(store.has);
|
|
637
|
+
var wmset = uncurryThis$2(store.set);
|
|
638
|
+
set = function (it, metadata) {
|
|
639
|
+
if (wmhas(store, it)) throw new TypeError$1(OBJECT_ALREADY_INITIALIZED);
|
|
640
|
+
metadata.facade = it;
|
|
641
|
+
wmset(store, it, metadata);
|
|
642
|
+
return metadata;
|
|
643
|
+
};
|
|
644
|
+
get = function (it) {
|
|
645
|
+
return wmget(store, it) || {};
|
|
646
|
+
};
|
|
647
|
+
has = function (it) {
|
|
648
|
+
return wmhas(store, it);
|
|
649
|
+
};
|
|
650
|
+
} else {
|
|
651
|
+
var STATE = sharedKey('state');
|
|
652
|
+
hiddenKeys$2[STATE] = true;
|
|
653
|
+
set = function (it, metadata) {
|
|
654
|
+
if (hasOwn$3(it, STATE)) throw new TypeError$1(OBJECT_ALREADY_INITIALIZED);
|
|
655
|
+
metadata.facade = it;
|
|
656
|
+
createNonEnumerableProperty$2(it, STATE, metadata);
|
|
657
|
+
return metadata;
|
|
658
|
+
};
|
|
659
|
+
get = function (it) {
|
|
660
|
+
return hasOwn$3(it, STATE) ? it[STATE] : {};
|
|
661
|
+
};
|
|
662
|
+
has = function (it) {
|
|
663
|
+
return hasOwn$3(it, STATE);
|
|
664
|
+
};
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
var internalState = {
|
|
668
|
+
set: set,
|
|
669
|
+
get: get,
|
|
670
|
+
has: has,
|
|
671
|
+
enforce: enforce,
|
|
672
|
+
getterFor: getterFor
|
|
673
|
+
};
|
|
674
|
+
|
|
675
|
+
var fails$1 = fails$8;
|
|
676
|
+
var isCallable$2 = isCallable$a;
|
|
677
|
+
var hasOwn$2 = hasOwnProperty_1;
|
|
678
|
+
var defineProperty = objectDefineProperty.f;
|
|
679
|
+
var CONFIGURABLE_FUNCTION_NAME = functionName.CONFIGURABLE;
|
|
680
|
+
var inspectSource = inspectSource$2;
|
|
681
|
+
var InternalStateModule = internalState;
|
|
682
|
+
|
|
683
|
+
var enforceInternalState = InternalStateModule.enforce;
|
|
684
|
+
var getInternalState = InternalStateModule.get;
|
|
685
|
+
|
|
686
|
+
var CONFIGURABLE_LENGTH = !fails$1(function () {
|
|
687
|
+
return defineProperty(function () { /* empty */ }, 'length', { value: 8 }).length !== 8;
|
|
688
|
+
});
|
|
689
|
+
|
|
690
|
+
var TEMPLATE = String(String).split('String');
|
|
691
|
+
|
|
692
|
+
var makeBuiltIn$1 = makeBuiltIn$2.exports = function (value, name, options) {
|
|
693
|
+
if (String(name).slice(0, 7) === 'Symbol(') {
|
|
694
|
+
name = '[' + String(name).replace(/^Symbol\(([^)]*)\)/, '$1') + ']';
|
|
695
|
+
}
|
|
696
|
+
if (options && options.getter) name = 'get ' + name;
|
|
697
|
+
if (options && options.setter) name = 'set ' + name;
|
|
698
|
+
if (!hasOwn$2(value, 'name') || (CONFIGURABLE_FUNCTION_NAME && value.name !== name)) {
|
|
699
|
+
defineProperty(value, 'name', { value: name, configurable: true });
|
|
700
|
+
}
|
|
701
|
+
if (CONFIGURABLE_LENGTH && options && hasOwn$2(options, 'arity') && value.length !== options.arity) {
|
|
702
|
+
defineProperty(value, 'length', { value: options.arity });
|
|
703
|
+
}
|
|
704
|
+
var state = enforceInternalState(value);
|
|
705
|
+
if (!hasOwn$2(state, 'source')) {
|
|
706
|
+
state.source = TEMPLATE.join(typeof name == 'string' ? name : '');
|
|
707
|
+
} return value;
|
|
708
|
+
};
|
|
709
|
+
|
|
710
|
+
// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
|
|
711
|
+
// eslint-disable-next-line no-extend-native -- required
|
|
712
|
+
Function.prototype.toString = makeBuiltIn$1(function toString() {
|
|
713
|
+
return isCallable$2(this) && getInternalState(this).source || inspectSource(this);
|
|
714
|
+
}, 'toString');
|
|
715
|
+
|
|
716
|
+
var global$3 = global$m;
|
|
717
|
+
var isCallable$1 = isCallable$a;
|
|
718
|
+
var createNonEnumerableProperty$1 = createNonEnumerableProperty$3;
|
|
719
|
+
var makeBuiltIn = makeBuiltIn$2.exports;
|
|
720
|
+
var setGlobal$1 = setGlobal$3;
|
|
721
|
+
|
|
722
|
+
var defineBuiltIn$1 = function (O, key, value, options) {
|
|
723
|
+
var unsafe = options ? !!options.unsafe : false;
|
|
724
|
+
var simple = options ? !!options.enumerable : false;
|
|
725
|
+
var noTargetGet = options ? !!options.noTargetGet : false;
|
|
726
|
+
var name = options && options.name !== undefined ? options.name : key;
|
|
727
|
+
if (isCallable$1(value)) makeBuiltIn(value, name, options);
|
|
728
|
+
if (O === global$3) {
|
|
729
|
+
if (simple) O[key] = value;
|
|
730
|
+
else setGlobal$1(key, value);
|
|
731
|
+
return O;
|
|
732
|
+
} else if (!unsafe) {
|
|
733
|
+
delete O[key];
|
|
734
|
+
} else if (!noTargetGet && O[key]) {
|
|
735
|
+
simple = true;
|
|
736
|
+
}
|
|
737
|
+
if (simple) O[key] = value;
|
|
738
|
+
else createNonEnumerableProperty$1(O, key, value);
|
|
739
|
+
return O;
|
|
740
|
+
};
|
|
741
|
+
|
|
742
|
+
var objectGetOwnPropertyNames = {};
|
|
743
|
+
|
|
744
|
+
var ceil = Math.ceil;
|
|
745
|
+
var floor = Math.floor;
|
|
746
|
+
|
|
747
|
+
// `ToIntegerOrInfinity` abstract operation
|
|
748
|
+
// https://tc39.es/ecma262/#sec-tointegerorinfinity
|
|
749
|
+
var toIntegerOrInfinity$2 = function (argument) {
|
|
750
|
+
var number = +argument;
|
|
751
|
+
// eslint-disable-next-line no-self-compare -- safe
|
|
752
|
+
return number !== number || number === 0 ? 0 : (number > 0 ? floor : ceil)(number);
|
|
753
|
+
};
|
|
754
|
+
|
|
755
|
+
var toIntegerOrInfinity$1 = toIntegerOrInfinity$2;
|
|
756
|
+
|
|
757
|
+
var max = Math.max;
|
|
758
|
+
var min$1 = Math.min;
|
|
759
|
+
|
|
760
|
+
// Helper for a popular repeating case of the spec:
|
|
761
|
+
// Let integer be ? ToInteger(index).
|
|
762
|
+
// If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
|
|
763
|
+
var toAbsoluteIndex$1 = function (index, length) {
|
|
764
|
+
var integer = toIntegerOrInfinity$1(index);
|
|
765
|
+
return integer < 0 ? max(integer + length, 0) : min$1(integer, length);
|
|
766
|
+
};
|
|
767
|
+
|
|
768
|
+
var toIntegerOrInfinity = toIntegerOrInfinity$2;
|
|
769
|
+
|
|
770
|
+
var min = Math.min;
|
|
771
|
+
|
|
772
|
+
// `ToLength` abstract operation
|
|
773
|
+
// https://tc39.es/ecma262/#sec-tolength
|
|
774
|
+
var toLength$1 = function (argument) {
|
|
775
|
+
return argument > 0 ? min(toIntegerOrInfinity(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
|
|
776
|
+
};
|
|
777
|
+
|
|
778
|
+
var toLength = toLength$1;
|
|
779
|
+
|
|
780
|
+
// `LengthOfArrayLike` abstract operation
|
|
781
|
+
// https://tc39.es/ecma262/#sec-lengthofarraylike
|
|
782
|
+
var lengthOfArrayLike$1 = function (obj) {
|
|
783
|
+
return toLength(obj.length);
|
|
784
|
+
};
|
|
785
|
+
|
|
786
|
+
var toIndexedObject$1 = toIndexedObject$3;
|
|
787
|
+
var toAbsoluteIndex = toAbsoluteIndex$1;
|
|
788
|
+
var lengthOfArrayLike = lengthOfArrayLike$1;
|
|
789
|
+
|
|
790
|
+
// `Array.prototype.{ indexOf, includes }` methods implementation
|
|
791
|
+
var createMethod = function (IS_INCLUDES) {
|
|
792
|
+
return function ($this, el, fromIndex) {
|
|
793
|
+
var O = toIndexedObject$1($this);
|
|
794
|
+
var length = lengthOfArrayLike(O);
|
|
795
|
+
var index = toAbsoluteIndex(fromIndex, length);
|
|
796
|
+
var value;
|
|
797
|
+
// Array#includes uses SameValueZero equality algorithm
|
|
798
|
+
// eslint-disable-next-line no-self-compare -- NaN check
|
|
799
|
+
if (IS_INCLUDES && el != el) while (length > index) {
|
|
800
|
+
value = O[index++];
|
|
801
|
+
// eslint-disable-next-line no-self-compare -- NaN check
|
|
802
|
+
if (value != value) return true;
|
|
803
|
+
// Array#indexOf ignores holes, Array#includes - not
|
|
804
|
+
} else for (;length > index; index++) {
|
|
805
|
+
if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
|
|
806
|
+
} return !IS_INCLUDES && -1;
|
|
807
|
+
};
|
|
808
|
+
};
|
|
809
|
+
|
|
810
|
+
var arrayIncludes = {
|
|
811
|
+
// `Array.prototype.includes` method
|
|
812
|
+
// https://tc39.es/ecma262/#sec-array.prototype.includes
|
|
813
|
+
includes: createMethod(true),
|
|
814
|
+
// `Array.prototype.indexOf` method
|
|
815
|
+
// https://tc39.es/ecma262/#sec-array.prototype.indexof
|
|
816
|
+
indexOf: createMethod(false)
|
|
817
|
+
};
|
|
818
|
+
|
|
819
|
+
var uncurryThis$1 = functionUncurryThis;
|
|
820
|
+
var hasOwn$1 = hasOwnProperty_1;
|
|
821
|
+
var toIndexedObject = toIndexedObject$3;
|
|
822
|
+
var indexOf = arrayIncludes.indexOf;
|
|
823
|
+
var hiddenKeys$1 = hiddenKeys$3;
|
|
824
|
+
|
|
825
|
+
var push$1 = uncurryThis$1([].push);
|
|
826
|
+
|
|
827
|
+
var objectKeysInternal = function (object, names) {
|
|
828
|
+
var O = toIndexedObject(object);
|
|
829
|
+
var i = 0;
|
|
830
|
+
var result = [];
|
|
831
|
+
var key;
|
|
832
|
+
for (key in O) !hasOwn$1(hiddenKeys$1, key) && hasOwn$1(O, key) && push$1(result, key);
|
|
833
|
+
// Don't enum bug & hidden keys
|
|
834
|
+
while (names.length > i) if (hasOwn$1(O, key = names[i++])) {
|
|
835
|
+
~indexOf(result, key) || push$1(result, key);
|
|
836
|
+
}
|
|
837
|
+
return result;
|
|
838
|
+
};
|
|
839
|
+
|
|
840
|
+
// IE8- don't enum bug keys
|
|
841
|
+
var enumBugKeys$1 = [
|
|
842
|
+
'constructor',
|
|
843
|
+
'hasOwnProperty',
|
|
844
|
+
'isPrototypeOf',
|
|
845
|
+
'propertyIsEnumerable',
|
|
846
|
+
'toLocaleString',
|
|
847
|
+
'toString',
|
|
848
|
+
'valueOf'
|
|
849
|
+
];
|
|
850
|
+
|
|
851
|
+
var internalObjectKeys = objectKeysInternal;
|
|
852
|
+
var enumBugKeys = enumBugKeys$1;
|
|
853
|
+
|
|
854
|
+
var hiddenKeys = enumBugKeys.concat('length', 'prototype');
|
|
855
|
+
|
|
856
|
+
// `Object.getOwnPropertyNames` method
|
|
857
|
+
// https://tc39.es/ecma262/#sec-object.getownpropertynames
|
|
858
|
+
// eslint-disable-next-line es-x/no-object-getownpropertynames -- safe
|
|
859
|
+
objectGetOwnPropertyNames.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
|
|
860
|
+
return internalObjectKeys(O, hiddenKeys);
|
|
861
|
+
};
|
|
862
|
+
|
|
863
|
+
var objectGetOwnPropertySymbols = {};
|
|
864
|
+
|
|
865
|
+
// eslint-disable-next-line es-x/no-object-getownpropertysymbols -- safe
|
|
866
|
+
objectGetOwnPropertySymbols.f = Object.getOwnPropertySymbols;
|
|
867
|
+
|
|
868
|
+
var getBuiltIn = getBuiltIn$3;
|
|
869
|
+
var uncurryThis = functionUncurryThis;
|
|
870
|
+
var getOwnPropertyNamesModule = objectGetOwnPropertyNames;
|
|
871
|
+
var getOwnPropertySymbolsModule = objectGetOwnPropertySymbols;
|
|
872
|
+
var anObject = anObject$2;
|
|
873
|
+
|
|
874
|
+
var concat = uncurryThis([].concat);
|
|
875
|
+
|
|
876
|
+
// all object keys, includes non-enumerable and symbols
|
|
877
|
+
var ownKeys$1 = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
|
|
878
|
+
var keys = getOwnPropertyNamesModule.f(anObject(it));
|
|
879
|
+
var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
|
|
880
|
+
return getOwnPropertySymbols ? concat(keys, getOwnPropertySymbols(it)) : keys;
|
|
881
|
+
};
|
|
882
|
+
|
|
883
|
+
var hasOwn = hasOwnProperty_1;
|
|
884
|
+
var ownKeys = ownKeys$1;
|
|
885
|
+
var getOwnPropertyDescriptorModule = objectGetOwnPropertyDescriptor;
|
|
886
|
+
var definePropertyModule = objectDefineProperty;
|
|
887
|
+
|
|
888
|
+
var copyConstructorProperties$1 = function (target, source, exceptions) {
|
|
889
|
+
var keys = ownKeys(source);
|
|
890
|
+
var defineProperty = definePropertyModule.f;
|
|
891
|
+
var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
|
|
892
|
+
for (var i = 0; i < keys.length; i++) {
|
|
893
|
+
var key = keys[i];
|
|
894
|
+
if (!hasOwn(target, key) && !(exceptions && hasOwn(exceptions, key))) {
|
|
895
|
+
defineProperty(target, key, getOwnPropertyDescriptor(source, key));
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
};
|
|
899
|
+
|
|
900
|
+
var fails = fails$8;
|
|
901
|
+
var isCallable = isCallable$a;
|
|
902
|
+
|
|
903
|
+
var replacement = /#|\.prototype\./;
|
|
904
|
+
|
|
905
|
+
var isForced$1 = function (feature, detection) {
|
|
906
|
+
var value = data$1[normalize$1(feature)];
|
|
907
|
+
return value == POLYFILL ? true
|
|
908
|
+
: value == NATIVE ? false
|
|
909
|
+
: isCallable(detection) ? fails(detection)
|
|
910
|
+
: !!detection;
|
|
911
|
+
};
|
|
912
|
+
|
|
913
|
+
var normalize$1 = isForced$1.normalize = function (string) {
|
|
914
|
+
return String(string).replace(replacement, '.').toLowerCase();
|
|
915
|
+
};
|
|
916
|
+
|
|
917
|
+
var data$1 = isForced$1.data = {};
|
|
918
|
+
var NATIVE = isForced$1.NATIVE = 'N';
|
|
919
|
+
var POLYFILL = isForced$1.POLYFILL = 'P';
|
|
920
|
+
|
|
921
|
+
var isForced_1 = isForced$1;
|
|
922
|
+
|
|
923
|
+
var global$2 = global$m;
|
|
924
|
+
var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
|
|
925
|
+
var createNonEnumerableProperty = createNonEnumerableProperty$3;
|
|
926
|
+
var defineBuiltIn = defineBuiltIn$1;
|
|
927
|
+
var setGlobal = setGlobal$3;
|
|
928
|
+
var copyConstructorProperties = copyConstructorProperties$1;
|
|
929
|
+
var isForced = isForced_1;
|
|
930
|
+
|
|
931
|
+
/*
|
|
932
|
+
options.target - name of the target object
|
|
933
|
+
options.global - target is the global object
|
|
934
|
+
options.stat - export as static methods of target
|
|
935
|
+
options.proto - export as prototype methods of target
|
|
936
|
+
options.real - real prototype method for the `pure` version
|
|
937
|
+
options.forced - export even if the native feature is available
|
|
938
|
+
options.bind - bind methods to the target, required for the `pure` version
|
|
939
|
+
options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
|
|
940
|
+
options.unsafe - use the simple assignment of property instead of delete + defineProperty
|
|
941
|
+
options.sham - add a flag to not completely full polyfills
|
|
942
|
+
options.enumerable - export as enumerable property
|
|
943
|
+
options.noTargetGet - prevent calling a getter on target
|
|
944
|
+
options.name - the .name of the function if it does not match the key
|
|
945
|
+
*/
|
|
946
|
+
var _export = function (options, source) {
|
|
947
|
+
var TARGET = options.target;
|
|
948
|
+
var GLOBAL = options.global;
|
|
949
|
+
var STATIC = options.stat;
|
|
950
|
+
var FORCED, target, key, targetProperty, sourceProperty, descriptor;
|
|
951
|
+
if (GLOBAL) {
|
|
952
|
+
target = global$2;
|
|
953
|
+
} else if (STATIC) {
|
|
954
|
+
target = global$2[TARGET] || setGlobal(TARGET, {});
|
|
955
|
+
} else {
|
|
956
|
+
target = (global$2[TARGET] || {}).prototype;
|
|
957
|
+
}
|
|
958
|
+
if (target) for (key in source) {
|
|
959
|
+
sourceProperty = source[key];
|
|
960
|
+
if (options.noTargetGet) {
|
|
961
|
+
descriptor = getOwnPropertyDescriptor(target, key);
|
|
962
|
+
targetProperty = descriptor && descriptor.value;
|
|
963
|
+
} else targetProperty = target[key];
|
|
964
|
+
FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
|
|
965
|
+
// contained in target
|
|
966
|
+
if (!FORCED && targetProperty !== undefined) {
|
|
967
|
+
if (typeof sourceProperty == typeof targetProperty) continue;
|
|
968
|
+
copyConstructorProperties(sourceProperty, targetProperty);
|
|
969
|
+
}
|
|
970
|
+
// add a flag to not completely full polyfills
|
|
971
|
+
if (options.sham || (targetProperty && targetProperty.sham)) {
|
|
972
|
+
createNonEnumerableProperty(sourceProperty, 'sham', true);
|
|
973
|
+
}
|
|
974
|
+
defineBuiltIn(target, key, sourceProperty, options);
|
|
975
|
+
}
|
|
976
|
+
};
|
|
977
|
+
|
|
978
|
+
var $ = _export;
|
|
979
|
+
var global$1 = global$m;
|
|
980
|
+
|
|
981
|
+
// `globalThis` object
|
|
982
|
+
// https://tc39.es/ecma262/#sec-globalthis
|
|
983
|
+
$({ global: true }, {
|
|
984
|
+
globalThis: global$1
|
|
985
|
+
});
|
|
986
|
+
|
|
987
|
+
if (typeof globalThis !== "undefined") {
|
|
988
|
+
if (typeof globalThis.console === "undefined") {
|
|
989
|
+
globalThis.console = {};
|
|
990
|
+
globalThis.console.log = function() {};
|
|
991
|
+
globalThis.console.assert = function() {};
|
|
992
|
+
globalThis.console.warn = function() {};
|
|
993
|
+
globalThis.console.error = function() {
|
|
15
994
|
alert(Array.prototype.slice.call(arguments).join(", "));
|
|
16
995
|
};
|
|
17
996
|
}
|
|
18
997
|
}
|
|
19
998
|
|
|
999
|
+
if ("performance" in globalThis === false) {
|
|
1000
|
+
globalThis.performance = {};
|
|
1001
|
+
}
|
|
1002
|
+
|
|
1003
|
+
Date.now = (Date.now || function () { // thanks IE8
|
|
1004
|
+
return new Date().getTime();
|
|
1005
|
+
});
|
|
1006
|
+
|
|
1007
|
+
if ("now" in globalThis.performance === false) {
|
|
1008
|
+
|
|
1009
|
+
var nowOffset = Date.now();
|
|
1010
|
+
|
|
1011
|
+
if (performance.timing && performance.timing.navigationStart) {
|
|
1012
|
+
nowOffset = performance.timing.navigationStart;
|
|
1013
|
+
}
|
|
1014
|
+
|
|
1015
|
+
globalThis.performance.now = function now() {
|
|
1016
|
+
return Date.now() - nowOffset;
|
|
1017
|
+
};
|
|
1018
|
+
}
|
|
1019
|
+
|
|
20
1020
|
/**
|
|
21
1021
|
* a collection of string utility functions
|
|
22
1022
|
* @namespace utils.string
|
|
@@ -104,13 +1104,13 @@ function toHex$1(str) {
|
|
|
104
1104
|
}
|
|
105
1105
|
|
|
106
1106
|
var stringUtils = /*#__PURE__*/Object.freeze({
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
1107
|
+
__proto__: null,
|
|
1108
|
+
capitalize: capitalize,
|
|
1109
|
+
trimLeft: trimLeft,
|
|
1110
|
+
trimRight: trimRight,
|
|
1111
|
+
isNumeric: isNumeric,
|
|
1112
|
+
isBoolean: isBoolean,
|
|
1113
|
+
toHex: toHex$1
|
|
114
1114
|
});
|
|
115
1115
|
|
|
116
1116
|
/**
|
|
@@ -130,12 +1130,12 @@ var vendors$1 = [ "ms", "MS", "moz", "webkit", "o" ];
|
|
|
130
1130
|
* @name prefixed
|
|
131
1131
|
* @function
|
|
132
1132
|
* @param {string} name Property name
|
|
133
|
-
* @param {object} [obj=
|
|
1133
|
+
* @param {object} [obj=globalThis] Object or element reference to access
|
|
134
1134
|
* @returns {string} Value of property
|
|
135
1135
|
* @memberof utils.agent
|
|
136
1136
|
*/
|
|
137
1137
|
function prefixed(name, obj) {
|
|
138
|
-
obj = obj ||
|
|
1138
|
+
obj = obj || globalThis;
|
|
139
1139
|
if (name in obj) {
|
|
140
1140
|
return obj[name];
|
|
141
1141
|
}
|
|
@@ -156,12 +1156,12 @@ function prefixed(name, obj) {
|
|
|
156
1156
|
* @function
|
|
157
1157
|
* @param {string} name Property name
|
|
158
1158
|
* @param {string} value Property value
|
|
159
|
-
* @param {object} [obj=
|
|
1159
|
+
* @param {object} [obj=globalThis] Object or element reference to access
|
|
160
1160
|
* @returns {boolean} true if one of the vendor-prefixed property was found
|
|
161
1161
|
* @memberof utils.agent
|
|
162
1162
|
*/
|
|
163
1163
|
function setPrefixed(name, value, obj) {
|
|
164
|
-
obj = obj ||
|
|
1164
|
+
obj = obj || globalThis;
|
|
165
1165
|
if (name in obj) {
|
|
166
1166
|
obj[name] = value;
|
|
167
1167
|
return;
|
|
@@ -181,9 +1181,9 @@ function setPrefixed(name, value, obj) {
|
|
|
181
1181
|
}
|
|
182
1182
|
|
|
183
1183
|
var agentUtils = /*#__PURE__*/Object.freeze({
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
1184
|
+
__proto__: null,
|
|
1185
|
+
prefixed: prefixed,
|
|
1186
|
+
setPrefixed: setPrefixed
|
|
187
1187
|
});
|
|
188
1188
|
|
|
189
1189
|
/**
|
|
@@ -398,22 +1398,22 @@ function toBeCloseTo(expected, actual, precision = 2) {
|
|
|
398
1398
|
}
|
|
399
1399
|
|
|
400
1400
|
var math = /*#__PURE__*/Object.freeze({
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
1401
|
+
__proto__: null,
|
|
1402
|
+
DEG_TO_RAD: DEG_TO_RAD,
|
|
1403
|
+
RAD_TO_DEG: RAD_TO_DEG,
|
|
1404
|
+
TAU: TAU,
|
|
1405
|
+
ETA: ETA,
|
|
1406
|
+
EPSILON: EPSILON,
|
|
1407
|
+
isPowerOfTwo: isPowerOfTwo,
|
|
1408
|
+
nextPowerOfTwo: nextPowerOfTwo,
|
|
1409
|
+
degToRad: degToRad,
|
|
1410
|
+
radToDeg: radToDeg,
|
|
1411
|
+
clamp: clamp,
|
|
1412
|
+
random: random$1,
|
|
1413
|
+
randomFloat: randomFloat,
|
|
1414
|
+
weightedRandom: weightedRandom$1,
|
|
1415
|
+
round: round,
|
|
1416
|
+
toBeCloseTo: toBeCloseTo
|
|
417
1417
|
});
|
|
418
1418
|
|
|
419
1419
|
/**
|
|
@@ -471,10 +1471,10 @@ function weightedRandom(arr) {
|
|
|
471
1471
|
}
|
|
472
1472
|
|
|
473
1473
|
var arrayUtils = /*#__PURE__*/Object.freeze({
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
1474
|
+
__proto__: null,
|
|
1475
|
+
remove: remove,
|
|
1476
|
+
random: random,
|
|
1477
|
+
weightedRandom: weightedRandom
|
|
478
1478
|
});
|
|
479
1479
|
|
|
480
1480
|
/**
|
|
@@ -513,9 +1513,9 @@ function getExtension(path) {
|
|
|
513
1513
|
}
|
|
514
1514
|
|
|
515
1515
|
var fileUtils = /*#__PURE__*/Object.freeze({
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
1516
|
+
__proto__: null,
|
|
1517
|
+
getBasename: getBasename,
|
|
1518
|
+
getExtension: getExtension
|
|
519
1519
|
});
|
|
520
1520
|
|
|
521
1521
|
/**
|
|
@@ -555,13 +1555,13 @@ function defer(func, thisArg, ...args) {
|
|
|
555
1555
|
* @returns {Function} the function that will be throttled
|
|
556
1556
|
*/
|
|
557
1557
|
function throttle(fn, delay, no_trailing) {
|
|
558
|
-
var last =
|
|
1558
|
+
var last = globalThis.performance.now(), deferTimer;
|
|
559
1559
|
// `no_trailing` defaults to false.
|
|
560
1560
|
if (typeof no_trailing !== "boolean") {
|
|
561
1561
|
no_trailing = false;
|
|
562
1562
|
}
|
|
563
1563
|
return function () {
|
|
564
|
-
var now =
|
|
1564
|
+
var now = globalThis.performance.now();
|
|
565
1565
|
var elasped = now - last;
|
|
566
1566
|
var args = arguments;
|
|
567
1567
|
if (elasped < delay) {
|
|
@@ -582,9 +1582,9 @@ function throttle(fn, delay, no_trailing) {
|
|
|
582
1582
|
}
|
|
583
1583
|
|
|
584
1584
|
var fnUtils = /*#__PURE__*/Object.freeze({
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
1585
|
+
__proto__: null,
|
|
1586
|
+
defer: defer,
|
|
1587
|
+
throttle: throttle
|
|
588
1588
|
});
|
|
589
1589
|
|
|
590
1590
|
var objectClass = {};
|
|
@@ -766,14 +1766,14 @@ function getInstanceCount() {
|
|
|
766
1766
|
}
|
|
767
1767
|
|
|
768
1768
|
var pooling = /*#__PURE__*/Object.freeze({
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
1769
|
+
__proto__: null,
|
|
1770
|
+
register: register,
|
|
1771
|
+
pull: pull,
|
|
1772
|
+
purge: purge,
|
|
1773
|
+
push: push,
|
|
1774
|
+
exists: exists,
|
|
1775
|
+
poolable: poolable,
|
|
1776
|
+
getInstanceCount: getInstanceCount
|
|
777
1777
|
});
|
|
778
1778
|
|
|
779
1779
|
/**
|
|
@@ -2384,72 +3384,73 @@ class Matrix3d {
|
|
|
2384
3384
|
* @returns {Matrix3d} Reference to this object for method chaining
|
|
2385
3385
|
*/
|
|
2386
3386
|
rotate(angle, v) {
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
3387
|
+
if (angle !== 0) {
|
|
3388
|
+
var a = this.val,
|
|
3389
|
+
x = v.x,
|
|
3390
|
+
y = v.y,
|
|
3391
|
+
z = v.z;
|
|
3392
|
+
|
|
3393
|
+
var len = Math.sqrt(x * x + y * y + z * z);
|
|
3394
|
+
|
|
3395
|
+
var s, c, t;
|
|
3396
|
+
var a00, a01, a02, a03;
|
|
3397
|
+
var a10, a11, a12, a13;
|
|
3398
|
+
var a20, a21, a22, a23;
|
|
3399
|
+
var b00, b01, b02;
|
|
3400
|
+
var b10, b11, b12;
|
|
3401
|
+
var b20, b21, b22;
|
|
3402
|
+
|
|
3403
|
+
if (len < EPSILON) {
|
|
3404
|
+
return null;
|
|
3405
|
+
}
|
|
3406
|
+
|
|
3407
|
+
len = 1 / len;
|
|
3408
|
+
x *= len;
|
|
3409
|
+
y *= len;
|
|
3410
|
+
z *= len;
|
|
3411
|
+
|
|
3412
|
+
s = Math.sin(angle);
|
|
3413
|
+
c = Math.cos(angle);
|
|
3414
|
+
t = 1 - c;
|
|
3415
|
+
|
|
3416
|
+
a00 = a[0];
|
|
3417
|
+
a01 = a[1];
|
|
3418
|
+
a02 = a[2];
|
|
3419
|
+
a03 = a[3];
|
|
3420
|
+
a10 = a[4];
|
|
3421
|
+
a11 = a[5];
|
|
3422
|
+
a12 = a[6];
|
|
3423
|
+
a13 = a[7];
|
|
3424
|
+
a20 = a[8];
|
|
3425
|
+
a21 = a[9];
|
|
3426
|
+
a22 = a[10];
|
|
3427
|
+
a23 = a[11];
|
|
2401
3428
|
|
|
2402
|
-
|
|
2403
|
-
|
|
3429
|
+
// Construct the elements of the rotation matrix
|
|
3430
|
+
b00 = x * x * t + c;
|
|
3431
|
+
b01 = y * x * t + z * s;
|
|
3432
|
+
b02 = z * x * t - y * s;
|
|
3433
|
+
b10 = x * y * t - z * s;
|
|
3434
|
+
b11 = y * y * t + c;
|
|
3435
|
+
b12 = z * y * t + x * s;
|
|
3436
|
+
b20 = x * z * t + y * s;
|
|
3437
|
+
b21 = y * z * t - x * s;
|
|
3438
|
+
b22 = z * z * t + c;
|
|
3439
|
+
|
|
3440
|
+
// Perform rotation-specific matrix multiplication
|
|
3441
|
+
a[0] = a00 * b00 + a10 * b01 + a20 * b02;
|
|
3442
|
+
a[1] = a01 * b00 + a11 * b01 + a21 * b02;
|
|
3443
|
+
a[2] = a02 * b00 + a12 * b01 + a22 * b02;
|
|
3444
|
+
a[3] = a03 * b00 + a13 * b01 + a23 * b02;
|
|
3445
|
+
a[4] = a00 * b10 + a10 * b11 + a20 * b12;
|
|
3446
|
+
a[5] = a01 * b10 + a11 * b11 + a21 * b12;
|
|
3447
|
+
a[6] = a02 * b10 + a12 * b11 + a22 * b12;
|
|
3448
|
+
a[7] = a03 * b10 + a13 * b11 + a23 * b12;
|
|
3449
|
+
a[8] = a00 * b20 + a10 * b21 + a20 * b22;
|
|
3450
|
+
a[9] = a01 * b20 + a11 * b21 + a21 * b22;
|
|
3451
|
+
a[10] = a02 * b20 + a12 * b21 + a22 * b22;
|
|
3452
|
+
a[11] = a03 * b20 + a13 * b21 + a23 * b22;
|
|
2404
3453
|
}
|
|
2405
|
-
|
|
2406
|
-
len = 1 / len;
|
|
2407
|
-
x *= len;
|
|
2408
|
-
y *= len;
|
|
2409
|
-
z *= len;
|
|
2410
|
-
|
|
2411
|
-
s = Math.sin(angle);
|
|
2412
|
-
c = Math.cos(angle);
|
|
2413
|
-
t = 1 - c;
|
|
2414
|
-
|
|
2415
|
-
a00 = a[0];
|
|
2416
|
-
a01 = a[1];
|
|
2417
|
-
a02 = a[2];
|
|
2418
|
-
a03 = a[3];
|
|
2419
|
-
a10 = a[4];
|
|
2420
|
-
a11 = a[5];
|
|
2421
|
-
a12 = a[6];
|
|
2422
|
-
a13 = a[7];
|
|
2423
|
-
a20 = a[8];
|
|
2424
|
-
a21 = a[9];
|
|
2425
|
-
a22 = a[10];
|
|
2426
|
-
a23 = a[11];
|
|
2427
|
-
|
|
2428
|
-
// Construct the elements of the rotation matrix
|
|
2429
|
-
b00 = x * x * t + c;
|
|
2430
|
-
b01 = y * x * t + z * s;
|
|
2431
|
-
b02 = z * x * t - y * s;
|
|
2432
|
-
b10 = x * y * t - z * s;
|
|
2433
|
-
b11 = y * y * t + c;
|
|
2434
|
-
b12 = z * y * t + x * s;
|
|
2435
|
-
b20 = x * z * t + y * s;
|
|
2436
|
-
b21 = y * z * t - x * s;
|
|
2437
|
-
b22 = z * z * t + c;
|
|
2438
|
-
|
|
2439
|
-
// Perform rotation-specific matrix multiplication
|
|
2440
|
-
a[0] = a00 * b00 + a10 * b01 + a20 * b02;
|
|
2441
|
-
a[1] = a01 * b00 + a11 * b01 + a21 * b02;
|
|
2442
|
-
a[2] = a02 * b00 + a12 * b01 + a22 * b02;
|
|
2443
|
-
a[3] = a03 * b00 + a13 * b01 + a23 * b02;
|
|
2444
|
-
a[4] = a00 * b10 + a10 * b11 + a20 * b12;
|
|
2445
|
-
a[5] = a01 * b10 + a11 * b11 + a21 * b12;
|
|
2446
|
-
a[6] = a02 * b10 + a12 * b11 + a22 * b12;
|
|
2447
|
-
a[7] = a03 * b10 + a13 * b11 + a23 * b12;
|
|
2448
|
-
a[8] = a00 * b20 + a10 * b21 + a20 * b22;
|
|
2449
|
-
a[9] = a01 * b20 + a11 * b21 + a21 * b22;
|
|
2450
|
-
a[10] = a02 * b20 + a12 * b21 + a22 * b22;
|
|
2451
|
-
a[11] = a03 * b20 + a13 * b21 + a23 * b22;
|
|
2452
|
-
|
|
2453
3454
|
return this;
|
|
2454
3455
|
}
|
|
2455
3456
|
|
|
@@ -3103,8 +4104,6 @@ class Matrix2d {
|
|
|
3103
4104
|
}
|
|
3104
4105
|
}
|
|
3105
4106
|
|
|
3106
|
-
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
3107
|
-
|
|
3108
4107
|
var eventemitter3 = {exports: {}};
|
|
3109
4108
|
|
|
3110
4109
|
(function (module) {
|
|
@@ -3804,7 +4803,7 @@ const DRAGEND = "me.game.dragend";
|
|
|
3804
4803
|
* @memberof event
|
|
3805
4804
|
* @see event.on
|
|
3806
4805
|
*/
|
|
3807
|
-
const WINDOW_ONRESIZE = "
|
|
4806
|
+
const WINDOW_ONRESIZE = "globalThis.onresize";
|
|
3808
4807
|
|
|
3809
4808
|
/**
|
|
3810
4809
|
* Event for when the canvas is resized <br>
|
|
@@ -3844,7 +4843,7 @@ const VIEWPORT_ONRESIZE = "viewport.onresize";
|
|
|
3844
4843
|
* @memberof event
|
|
3845
4844
|
* @see event.on
|
|
3846
4845
|
*/
|
|
3847
|
-
const WINDOW_ONORIENTATION_CHANGE = "
|
|
4846
|
+
const WINDOW_ONORIENTATION_CHANGE = "globalThis.orientationchange";
|
|
3848
4847
|
|
|
3849
4848
|
/**
|
|
3850
4849
|
* Event for when the (browser) window is scrolled <br>
|
|
@@ -3856,7 +4855,7 @@ const WINDOW_ONORIENTATION_CHANGE = "window.orientationchange";
|
|
|
3856
4855
|
* @memberof event
|
|
3857
4856
|
* @see event.on
|
|
3858
4857
|
*/
|
|
3859
|
-
const WINDOW_ONSCROLL = "
|
|
4858
|
+
const WINDOW_ONSCROLL = "globalThis.onscroll";
|
|
3860
4859
|
|
|
3861
4860
|
/**
|
|
3862
4861
|
* Event for when the viewport position is updated <br>
|
|
@@ -3871,8 +4870,8 @@ const WINDOW_ONSCROLL = "window.onscroll";
|
|
|
3871
4870
|
const VIEWPORT_ONCHANGE = "viewport.onchange";
|
|
3872
4871
|
|
|
3873
4872
|
/**
|
|
3874
|
-
* Event for when
|
|
3875
|
-
* Data passed : {me.
|
|
4873
|
+
* Event for when the current context is lost <br>
|
|
4874
|
+
* Data passed : {me.Renderer} the current renderer instance
|
|
3876
4875
|
* @public
|
|
3877
4876
|
* @constant
|
|
3878
4877
|
* @type {string}
|
|
@@ -3880,19 +4879,19 @@ const VIEWPORT_ONCHANGE = "viewport.onchange";
|
|
|
3880
4879
|
* @memberof event
|
|
3881
4880
|
* @see event.on
|
|
3882
4881
|
*/
|
|
3883
|
-
const
|
|
4882
|
+
const ONCONTEXT_LOST = "renderer.contextlost";
|
|
3884
4883
|
|
|
3885
4884
|
/**
|
|
3886
|
-
* Event for when
|
|
3887
|
-
* Data passed : {me.
|
|
4885
|
+
* Event for when the current context is restored <br>
|
|
4886
|
+
* Data passed : {me.Renderer} the current renderer instance`
|
|
3888
4887
|
* @public
|
|
3889
4888
|
* @constant
|
|
3890
4889
|
* @type {string}
|
|
3891
|
-
* @name
|
|
4890
|
+
* @name ONCONTEXT_RESTORED
|
|
3892
4891
|
* @memberof event
|
|
3893
4892
|
* @see event.on
|
|
3894
4893
|
*/
|
|
3895
|
-
const
|
|
4894
|
+
const ONCONTEXT_RESTORED = "renderer.contextrestored";
|
|
3896
4895
|
|
|
3897
4896
|
/**
|
|
3898
4897
|
* calls each of the listeners registered for a given event.
|
|
@@ -3948,45 +4947,45 @@ function off(eventName, listener) {
|
|
|
3948
4947
|
return eventEmitter.off(eventName, listener);
|
|
3949
4948
|
}
|
|
3950
4949
|
|
|
3951
|
-
var event = /*#__PURE__*/Object.freeze({
|
|
3952
|
-
|
|
3953
|
-
|
|
3954
|
-
|
|
3955
|
-
|
|
3956
|
-
|
|
3957
|
-
|
|
3958
|
-
|
|
3959
|
-
|
|
3960
|
-
|
|
3961
|
-
|
|
3962
|
-
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
|
|
3966
|
-
|
|
3967
|
-
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
|
|
3971
|
-
|
|
3972
|
-
|
|
3973
|
-
|
|
3974
|
-
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
|
|
3983
|
-
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
|
|
4950
|
+
var event$1 = /*#__PURE__*/Object.freeze({
|
|
4951
|
+
__proto__: null,
|
|
4952
|
+
BOOT: BOOT,
|
|
4953
|
+
STATE_PAUSE: STATE_PAUSE,
|
|
4954
|
+
STATE_RESUME: STATE_RESUME,
|
|
4955
|
+
STATE_STOP: STATE_STOP,
|
|
4956
|
+
STATE_RESTART: STATE_RESTART,
|
|
4957
|
+
VIDEO_INIT: VIDEO_INIT,
|
|
4958
|
+
GAME_INIT: GAME_INIT,
|
|
4959
|
+
GAME_RESET: GAME_RESET,
|
|
4960
|
+
GAME_BEFORE_UPDATE: GAME_BEFORE_UPDATE,
|
|
4961
|
+
GAME_AFTER_UPDATE: GAME_AFTER_UPDATE,
|
|
4962
|
+
GAME_UPDATE: GAME_UPDATE,
|
|
4963
|
+
GAME_BEFORE_DRAW: GAME_BEFORE_DRAW,
|
|
4964
|
+
GAME_AFTER_DRAW: GAME_AFTER_DRAW,
|
|
4965
|
+
LEVEL_LOADED: LEVEL_LOADED,
|
|
4966
|
+
LOADER_COMPLETE: LOADER_COMPLETE,
|
|
4967
|
+
LOADER_PROGRESS: LOADER_PROGRESS,
|
|
4968
|
+
KEYDOWN: KEYDOWN,
|
|
4969
|
+
KEYUP: KEYUP,
|
|
4970
|
+
GAMEPAD_CONNECTED: GAMEPAD_CONNECTED,
|
|
4971
|
+
GAMEPAD_DISCONNECTED: GAMEPAD_DISCONNECTED,
|
|
4972
|
+
GAMEPAD_UPDATE: GAMEPAD_UPDATE,
|
|
4973
|
+
POINTERMOVE: POINTERMOVE,
|
|
4974
|
+
POINTERLOCKCHANGE: POINTERLOCKCHANGE,
|
|
4975
|
+
DRAGSTART: DRAGSTART,
|
|
4976
|
+
DRAGEND: DRAGEND,
|
|
4977
|
+
WINDOW_ONRESIZE: WINDOW_ONRESIZE,
|
|
4978
|
+
CANVAS_ONRESIZE: CANVAS_ONRESIZE,
|
|
4979
|
+
VIEWPORT_ONRESIZE: VIEWPORT_ONRESIZE,
|
|
4980
|
+
WINDOW_ONORIENTATION_CHANGE: WINDOW_ONORIENTATION_CHANGE,
|
|
4981
|
+
WINDOW_ONSCROLL: WINDOW_ONSCROLL,
|
|
4982
|
+
VIEWPORT_ONCHANGE: VIEWPORT_ONCHANGE,
|
|
4983
|
+
ONCONTEXT_LOST: ONCONTEXT_LOST,
|
|
4984
|
+
ONCONTEXT_RESTORED: ONCONTEXT_RESTORED,
|
|
4985
|
+
emit: emit,
|
|
4986
|
+
on: on,
|
|
4987
|
+
once: once,
|
|
4988
|
+
off: off
|
|
3990
4989
|
});
|
|
3991
4990
|
|
|
3992
4991
|
var howler = {};
|
|
@@ -10158,6 +11157,21 @@ class Rect extends Polygon {
|
|
|
10158
11157
|
this.pos.y = value - (this.height / 2);
|
|
10159
11158
|
}
|
|
10160
11159
|
|
|
11160
|
+
/**
|
|
11161
|
+
* center the rectangle position around the given coordinates
|
|
11162
|
+
* @name centerOn
|
|
11163
|
+
* @memberof Rect.prototype
|
|
11164
|
+
* @function
|
|
11165
|
+
* @param {number} x the x coordinate around which to center this rectangle
|
|
11166
|
+
* @param {number} x the y coordinate around which to center this rectangle
|
|
11167
|
+
* @returns {Rect} this rectangle
|
|
11168
|
+
*/
|
|
11169
|
+
centerOn(x, y) {
|
|
11170
|
+
this.centerX = x;
|
|
11171
|
+
this.centerY = y;
|
|
11172
|
+
return this;
|
|
11173
|
+
}
|
|
11174
|
+
|
|
10161
11175
|
/**
|
|
10162
11176
|
* resize the rectangle
|
|
10163
11177
|
* @name resize
|
|
@@ -10664,9 +11678,11 @@ var KEY = {
|
|
|
10664
11678
|
function initKeyboardEvent() {
|
|
10665
11679
|
// make sure the keyboard is enable
|
|
10666
11680
|
if (keyBoardEventTarget === null && device$1.isMobile === false) {
|
|
10667
|
-
keyBoardEventTarget =
|
|
10668
|
-
keyBoardEventTarget.addEventListener
|
|
10669
|
-
|
|
11681
|
+
keyBoardEventTarget = globalThis;
|
|
11682
|
+
if (typeof keyBoardEventTarget.addEventListener === "function") {
|
|
11683
|
+
keyBoardEventTarget.addEventListener("keydown", keyDownEvent, false);
|
|
11684
|
+
keyBoardEventTarget.addEventListener("keyup", keyUpEvent, false);
|
|
11685
|
+
}
|
|
10670
11686
|
}
|
|
10671
11687
|
}
|
|
10672
11688
|
/**
|
|
@@ -11591,7 +12607,7 @@ class Pointer extends Bounds$1 {
|
|
|
11591
12607
|
this.gameScreenY = this.y = tmpVec.y;
|
|
11592
12608
|
|
|
11593
12609
|
// true if not originally a pointer event
|
|
11594
|
-
this.isNormalized = !device$1.PointerEvent || (device$1.PointerEvent && !(event instanceof
|
|
12610
|
+
this.isNormalized = !device$1.PointerEvent || (device$1.PointerEvent && !(event instanceof globalThis.PointerEvent));
|
|
11595
12611
|
|
|
11596
12612
|
this.locked = locked;
|
|
11597
12613
|
this.movementX = event.movementX || 0;
|
|
@@ -12189,8 +13205,8 @@ function globalToLocal(x, y, v) {
|
|
|
12189
13205
|
v = v || pull("Vector2d");
|
|
12190
13206
|
var rect = device$1.getElementBounds(renderer.getScreenCanvas());
|
|
12191
13207
|
var pixelRatio = device$1.devicePixelRatio;
|
|
12192
|
-
x -= rect.left + (
|
|
12193
|
-
y -= rect.top + (
|
|
13208
|
+
x -= rect.left + (globalThis.pageXOffset || 0);
|
|
13209
|
+
y -= rect.top + (globalThis.pageYOffset || 0);
|
|
12194
13210
|
var scale = scaleRatio;
|
|
12195
13211
|
if (scale.x !== 1.0 || scale.y !== 1.0) {
|
|
12196
13212
|
x /= scale.x;
|
|
@@ -12405,7 +13421,6 @@ function releaseAllPointerEvents(region) {
|
|
|
12405
13421
|
* @memberof input
|
|
12406
13422
|
* @public
|
|
12407
13423
|
* @function
|
|
12408
|
-
* @param {Function} [success] callback if the request is successful
|
|
12409
13424
|
* @returns {boolean} return true if the request was successfully submitted
|
|
12410
13425
|
* @example
|
|
12411
13426
|
* // register on the pointer lock change event
|
|
@@ -12703,17 +13718,19 @@ var updateGamepads = function () {
|
|
|
12703
13718
|
* gamepad connected callback
|
|
12704
13719
|
* @ignore
|
|
12705
13720
|
*/
|
|
12706
|
-
|
|
12707
|
-
|
|
12708
|
-
|
|
13721
|
+
if (globalThis.navigator && typeof globalThis.navigator.getGamepads === "function") {
|
|
13722
|
+
globalThis.addEventListener("gamepadconnected", function (e) {
|
|
13723
|
+
emit(GAMEPAD_CONNECTED, e.gamepad);
|
|
13724
|
+
}, false);
|
|
12709
13725
|
|
|
12710
|
-
/**
|
|
12711
|
-
|
|
12712
|
-
|
|
12713
|
-
|
|
12714
|
-
|
|
12715
|
-
|
|
12716
|
-
}, false);
|
|
13726
|
+
/**
|
|
13727
|
+
* gamepad disconnected callback
|
|
13728
|
+
* @ignore
|
|
13729
|
+
*/
|
|
13730
|
+
globalThis.addEventListener("gamepaddisconnected", function (e) {
|
|
13731
|
+
emit(GAMEPAD_DISCONNECTED, e.gamepad);
|
|
13732
|
+
}, false);
|
|
13733
|
+
}
|
|
12717
13734
|
|
|
12718
13735
|
/*
|
|
12719
13736
|
* PUBLIC STUFF
|
|
@@ -12951,36 +13968,36 @@ var setGamepadMapping = addMapping;
|
|
|
12951
13968
|
var preventDefault = true;
|
|
12952
13969
|
|
|
12953
13970
|
var input = /*#__PURE__*/Object.freeze({
|
|
12954
|
-
|
|
12955
|
-
|
|
12956
|
-
|
|
12957
|
-
|
|
12958
|
-
|
|
12959
|
-
|
|
12960
|
-
|
|
12961
|
-
|
|
12962
|
-
|
|
12963
|
-
|
|
12964
|
-
|
|
12965
|
-
|
|
12966
|
-
|
|
12967
|
-
|
|
12968
|
-
|
|
12969
|
-
|
|
12970
|
-
|
|
12971
|
-
|
|
12972
|
-
|
|
12973
|
-
|
|
12974
|
-
|
|
12975
|
-
|
|
12976
|
-
|
|
12977
|
-
|
|
12978
|
-
|
|
12979
|
-
|
|
12980
|
-
|
|
12981
|
-
|
|
12982
|
-
|
|
12983
|
-
|
|
13971
|
+
__proto__: null,
|
|
13972
|
+
preventDefault: preventDefault,
|
|
13973
|
+
get pointerEventTarget () { return pointerEventTarget; },
|
|
13974
|
+
pointer: pointer,
|
|
13975
|
+
get locked () { return locked; },
|
|
13976
|
+
get throttlingInterval () { return throttlingInterval; },
|
|
13977
|
+
globalToLocal: globalToLocal,
|
|
13978
|
+
setTouchAction: setTouchAction,
|
|
13979
|
+
bindPointer: bindPointer,
|
|
13980
|
+
unbindPointer: unbindPointer,
|
|
13981
|
+
registerPointerEvent: registerPointerEvent,
|
|
13982
|
+
releasePointerEvent: releasePointerEvent,
|
|
13983
|
+
releaseAllPointerEvents: releaseAllPointerEvents,
|
|
13984
|
+
requestPointerLock: requestPointerLock,
|
|
13985
|
+
exitPointerLock: exitPointerLock,
|
|
13986
|
+
get keyBoardEventTarget () { return keyBoardEventTarget; },
|
|
13987
|
+
KEY: KEY,
|
|
13988
|
+
initKeyboardEvent: initKeyboardEvent,
|
|
13989
|
+
isKeyPressed: isKeyPressed,
|
|
13990
|
+
keyStatus: keyStatus,
|
|
13991
|
+
triggerKeyEvent: triggerKeyEvent,
|
|
13992
|
+
bindKey: bindKey,
|
|
13993
|
+
getBindingKey: getBindingKey,
|
|
13994
|
+
unlockKey: unlockKey,
|
|
13995
|
+
unbindKey: unbindKey,
|
|
13996
|
+
GAMEPAD: GAMEPAD,
|
|
13997
|
+
bindGamepad: bindGamepad,
|
|
13998
|
+
unbindGamepad: unbindGamepad,
|
|
13999
|
+
setGamepadDeadzone: setGamepadDeadzone,
|
|
14000
|
+
setGamepadMapping: setGamepadMapping
|
|
12984
14001
|
});
|
|
12985
14002
|
|
|
12986
14003
|
/**
|
|
@@ -14603,11 +15620,11 @@ function testEllipsePolygon(a, ellipseA, b, polyB, response) {
|
|
|
14603
15620
|
}
|
|
14604
15621
|
|
|
14605
15622
|
var SAT = /*#__PURE__*/Object.freeze({
|
|
14606
|
-
|
|
14607
|
-
|
|
14608
|
-
|
|
14609
|
-
|
|
14610
|
-
|
|
15623
|
+
__proto__: null,
|
|
15624
|
+
testPolygonPolygon: testPolygonPolygon,
|
|
15625
|
+
testEllipseEllipse: testEllipseEllipse,
|
|
15626
|
+
testPolygonEllipse: testPolygonEllipse,
|
|
15627
|
+
testEllipsePolygon: testEllipsePolygon
|
|
14611
15628
|
});
|
|
14612
15629
|
|
|
14613
15630
|
// a dummy object when using Line for raycasting
|
|
@@ -17302,7 +18319,7 @@ let sortOn = "z";
|
|
|
17302
18319
|
* @name lastUpdate
|
|
17303
18320
|
* @memberof game
|
|
17304
18321
|
*/
|
|
17305
|
-
let lastUpdate =
|
|
18322
|
+
let lastUpdate = globalThis.performance.now();
|
|
17306
18323
|
|
|
17307
18324
|
/**
|
|
17308
18325
|
* Fired when a level is fully loaded and all entities instantiated. <br>
|
|
@@ -17392,7 +18409,7 @@ function update$1(time, stage) {
|
|
|
17392
18409
|
accumulatorUpdateDelta = (timer$1.interpolation) ? updateDelta : Math.max(updateDelta, updateAverageDelta);
|
|
17393
18410
|
|
|
17394
18411
|
while (accumulator >= accumulatorUpdateDelta || timer$1.interpolation) {
|
|
17395
|
-
lastUpdateStart =
|
|
18412
|
+
lastUpdateStart = globalThis.performance.now();
|
|
17396
18413
|
|
|
17397
18414
|
// game update event
|
|
17398
18415
|
if (state.isPaused() !== true) {
|
|
@@ -17402,7 +18419,7 @@ function update$1(time, stage) {
|
|
|
17402
18419
|
// update all objects (and pass the elapsed time since last frame)
|
|
17403
18420
|
isDirty = stage.update(updateDelta) || isDirty;
|
|
17404
18421
|
|
|
17405
|
-
lastUpdate =
|
|
18422
|
+
lastUpdate = globalThis.performance.now();
|
|
17406
18423
|
updateAverageDelta = lastUpdate - lastUpdateStart;
|
|
17407
18424
|
|
|
17408
18425
|
accumulator -= accumulatorUpdateDelta;
|
|
@@ -17426,7 +18443,7 @@ function draw(stage) {
|
|
|
17426
18443
|
|
|
17427
18444
|
if (renderer.isContextValid === true && (isDirty || isAlwaysDirty)) {
|
|
17428
18445
|
// publish notification
|
|
17429
|
-
emit(GAME_BEFORE_DRAW,
|
|
18446
|
+
emit(GAME_BEFORE_DRAW, globalThis.performance.now());
|
|
17430
18447
|
|
|
17431
18448
|
// prepare renderer to draw a new frame
|
|
17432
18449
|
renderer.clear();
|
|
@@ -17441,24 +18458,24 @@ function draw(stage) {
|
|
|
17441
18458
|
renderer.flush();
|
|
17442
18459
|
|
|
17443
18460
|
// publish notification
|
|
17444
|
-
emit(GAME_AFTER_DRAW,
|
|
18461
|
+
emit(GAME_AFTER_DRAW, globalThis.performance.now());
|
|
17445
18462
|
}
|
|
17446
18463
|
}
|
|
17447
18464
|
|
|
17448
18465
|
var game = /*#__PURE__*/Object.freeze({
|
|
17449
|
-
|
|
17450
|
-
|
|
17451
|
-
|
|
17452
|
-
|
|
17453
|
-
|
|
17454
|
-
|
|
17455
|
-
|
|
17456
|
-
|
|
17457
|
-
|
|
17458
|
-
|
|
17459
|
-
|
|
17460
|
-
|
|
17461
|
-
|
|
18466
|
+
__proto__: null,
|
|
18467
|
+
get viewport () { return viewport; },
|
|
18468
|
+
get world () { return world; },
|
|
18469
|
+
mergeGroup: mergeGroup,
|
|
18470
|
+
sortOn: sortOn,
|
|
18471
|
+
get lastUpdate () { return lastUpdate; },
|
|
18472
|
+
onLevelLoaded: onLevelLoaded,
|
|
18473
|
+
reset: reset,
|
|
18474
|
+
updateFrameRate: updateFrameRate,
|
|
18475
|
+
getParentContainer: getParentContainer,
|
|
18476
|
+
repaint: repaint,
|
|
18477
|
+
update: update$1,
|
|
18478
|
+
draw: draw
|
|
17462
18479
|
});
|
|
17463
18480
|
|
|
17464
18481
|
// some ref shortcut
|
|
@@ -18556,7 +19573,7 @@ function _startRunLoop() {
|
|
|
18556
19573
|
timer$1.reset();
|
|
18557
19574
|
|
|
18558
19575
|
// start the main loop
|
|
18559
|
-
_animFrameId =
|
|
19576
|
+
_animFrameId = globalThis.requestAnimationFrame(_renderFrame);
|
|
18560
19577
|
}
|
|
18561
19578
|
}
|
|
18562
19579
|
|
|
@@ -18596,7 +19613,7 @@ function _renderFrame(time) {
|
|
|
18596
19613
|
draw(stage);
|
|
18597
19614
|
// schedule the next frame update
|
|
18598
19615
|
if (_animFrameId !== -1) {
|
|
18599
|
-
_animFrameId =
|
|
19616
|
+
_animFrameId = globalThis.requestAnimationFrame(_renderFrame);
|
|
18600
19617
|
}
|
|
18601
19618
|
}
|
|
18602
19619
|
|
|
@@ -18606,7 +19623,7 @@ function _renderFrame(time) {
|
|
|
18606
19623
|
*/
|
|
18607
19624
|
function _stopRunLoop() {
|
|
18608
19625
|
// cancel any previous animationRequestFrame
|
|
18609
|
-
|
|
19626
|
+
globalThis.cancelAnimationFrame(_animFrameId);
|
|
18610
19627
|
_animFrameId = -1;
|
|
18611
19628
|
}
|
|
18612
19629
|
|
|
@@ -18779,7 +19796,7 @@ var state = {
|
|
|
18779
19796
|
}
|
|
18780
19797
|
|
|
18781
19798
|
// store time when stopped
|
|
18782
|
-
_pauseTime =
|
|
19799
|
+
_pauseTime = globalThis.performance.now();
|
|
18783
19800
|
|
|
18784
19801
|
// publish the stop notification
|
|
18785
19802
|
emit(STATE_STOP);
|
|
@@ -18805,7 +19822,7 @@ var state = {
|
|
|
18805
19822
|
}
|
|
18806
19823
|
|
|
18807
19824
|
// store time when paused
|
|
18808
|
-
_pauseTime =
|
|
19825
|
+
_pauseTime = globalThis.performance.now();
|
|
18809
19826
|
|
|
18810
19827
|
// publish the pause event
|
|
18811
19828
|
emit(STATE_PAUSE);
|
|
@@ -18830,7 +19847,7 @@ var state = {
|
|
|
18830
19847
|
}
|
|
18831
19848
|
|
|
18832
19849
|
// calculate the elpased time
|
|
18833
|
-
_pauseTime =
|
|
19850
|
+
_pauseTime = globalThis.performance.now() - _pauseTime;
|
|
18834
19851
|
|
|
18835
19852
|
// force repaint
|
|
18836
19853
|
repaint();
|
|
@@ -18858,7 +19875,7 @@ var state = {
|
|
|
18858
19875
|
}
|
|
18859
19876
|
|
|
18860
19877
|
// calculate the elpased time
|
|
18861
|
-
_pauseTime =
|
|
19878
|
+
_pauseTime = globalThis.performance.now() - _pauseTime;
|
|
18862
19879
|
|
|
18863
19880
|
// publish the resume event
|
|
18864
19881
|
emit(STATE_RESUME, _pauseTime);
|
|
@@ -19199,7 +20216,7 @@ function decodeBase64AsArray(input, bytes) {
|
|
|
19199
20216
|
bytes = bytes || 1;
|
|
19200
20217
|
|
|
19201
20218
|
var i, j, len;
|
|
19202
|
-
var dec =
|
|
20219
|
+
var dec = globalThis.atob(input.replace(/[^A-Za-z0-9\+\/\=]/g, ""));
|
|
19203
20220
|
var ar = new Uint32Array(dec.length / bytes);
|
|
19204
20221
|
|
|
19205
20222
|
for (i = 0, len = dec.length / bytes; i < len; i++) {
|
|
@@ -21479,9 +22496,9 @@ class Renderer {
|
|
|
21479
22496
|
if (device$1.ejecta === true) {
|
|
21480
22497
|
// a main canvas is already automatically created by Ejecta
|
|
21481
22498
|
this.canvas = document.getElementById("canvas");
|
|
21482
|
-
} else if (typeof
|
|
22499
|
+
} else if (typeof globalThis.canvas !== "undefined") {
|
|
21483
22500
|
// a global canvas is available, e.g. webapp adapter for wechat
|
|
21484
|
-
this.canvas =
|
|
22501
|
+
this.canvas = globalThis.canvas;
|
|
21485
22502
|
} else if (typeof this.settings.canvas !== "undefined") {
|
|
21486
22503
|
this.canvas = this.settings.canvas;
|
|
21487
22504
|
} else {
|
|
@@ -21908,6 +22925,18 @@ class CanvasRenderer extends Renderer {
|
|
|
21908
22925
|
// enable the tile texture seam fix with the canvas renderer
|
|
21909
22926
|
this.uvOffset = 1;
|
|
21910
22927
|
}
|
|
22928
|
+
|
|
22929
|
+
// context lost & restore event for canvas
|
|
22930
|
+
this.getScreenCanvas().addEventListener("contextlost", (e) => {
|
|
22931
|
+
e.preventDefault();
|
|
22932
|
+
this.isContextValid = false;
|
|
22933
|
+
event.emit(event.ONCONTEXT_LOST, this);
|
|
22934
|
+
}, false );
|
|
22935
|
+
// ctx.restoreContext()
|
|
22936
|
+
this.getScreenCanvas().addEventListener("contextrestored", () => {
|
|
22937
|
+
this.isContextValid = true;
|
|
22938
|
+
event.emit(event.ONCONTEXT_RESTORED, this);
|
|
22939
|
+
}, false );
|
|
21911
22940
|
}
|
|
21912
22941
|
|
|
21913
22942
|
/**
|
|
@@ -21938,7 +22967,7 @@ class CanvasRenderer extends Renderer {
|
|
|
21938
22967
|
* <img src="images/normal-blendmode.png" width="510"/> <br>
|
|
21939
22968
|
* - "multiply" : the pixels of the top layer are multiplied with the corresponding pixel of the bottom layer. A darker picture is the result. <br>
|
|
21940
22969
|
* <img src="images/multiply-blendmode.png" width="510"/> <br>
|
|
21941
|
-
* - "lighter" : where both content overlap the color is determined by adding color values. <br>
|
|
22970
|
+
* - "additive or lighter" : where both content overlap the color is determined by adding color values. <br>
|
|
21942
22971
|
* <img src="images/lighter-blendmode.png" width="510"/> <br>
|
|
21943
22972
|
* - "screen" : The pixels are inverted, multiplied, and inverted again. A lighter picture is the result (opposite of multiply) <br>
|
|
21944
22973
|
* <img src="images/screen-blendmode.png" width="510"/> <br>
|
|
@@ -21946,7 +22975,7 @@ class CanvasRenderer extends Renderer {
|
|
|
21946
22975
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/globalCompositeOperation
|
|
21947
22976
|
* @memberof CanvasRenderer.prototype
|
|
21948
22977
|
* @function
|
|
21949
|
-
* @param {string} [mode="normal"] blend mode : "normal", "multiply", "lighter, "screen"
|
|
22978
|
+
* @param {string} [mode="normal"] blend mode : "normal", "multiply", "lighter, "additive", "screen"
|
|
21950
22979
|
* @param {CanvasRenderingContext2D} [context]
|
|
21951
22980
|
*/
|
|
21952
22981
|
setBlendMode(mode = "normal", context) {
|
|
@@ -21958,6 +22987,7 @@ class CanvasRenderer extends Renderer {
|
|
|
21958
22987
|
break;
|
|
21959
22988
|
|
|
21960
22989
|
case "lighter" :
|
|
22990
|
+
case "additive" :
|
|
21961
22991
|
context.globalCompositeOperation = "lighter";
|
|
21962
22992
|
break;
|
|
21963
22993
|
|
|
@@ -26384,7 +27414,7 @@ function preloadTMX(tmxData, onload, onerror) {
|
|
|
26384
27414
|
case "tsx":
|
|
26385
27415
|
// ie9 does not fully implement the responseXML
|
|
26386
27416
|
if (device$1.ua.match(/msie/i) || !xmlhttp.responseXML) {
|
|
26387
|
-
if (
|
|
27417
|
+
if (globalThis.DOMParser) {
|
|
26388
27418
|
// manually create the XML DOM
|
|
26389
27419
|
result = (new DOMParser()).parseFromString(xmlhttp.responseText, "text/xml");
|
|
26390
27420
|
} else {
|
|
@@ -27484,35 +28514,35 @@ function unloadAll() {
|
|
|
27484
28514
|
}
|
|
27485
28515
|
|
|
27486
28516
|
var audio = /*#__PURE__*/Object.freeze({
|
|
27487
|
-
|
|
27488
|
-
|
|
27489
|
-
|
|
27490
|
-
|
|
27491
|
-
|
|
27492
|
-
|
|
27493
|
-
|
|
27494
|
-
|
|
27495
|
-
|
|
27496
|
-
|
|
27497
|
-
|
|
27498
|
-
|
|
27499
|
-
|
|
27500
|
-
|
|
27501
|
-
|
|
27502
|
-
|
|
27503
|
-
|
|
27504
|
-
|
|
27505
|
-
|
|
27506
|
-
|
|
27507
|
-
|
|
27508
|
-
|
|
27509
|
-
|
|
27510
|
-
|
|
27511
|
-
|
|
27512
|
-
|
|
27513
|
-
|
|
27514
|
-
|
|
27515
|
-
|
|
28517
|
+
__proto__: null,
|
|
28518
|
+
stopOnAudioError: stopOnAudioError,
|
|
28519
|
+
init: init$1,
|
|
28520
|
+
hasFormat: hasFormat,
|
|
28521
|
+
hasAudio: hasAudio,
|
|
28522
|
+
enable: enable,
|
|
28523
|
+
disable: disable,
|
|
28524
|
+
load: load,
|
|
28525
|
+
play: play,
|
|
28526
|
+
fade: fade,
|
|
28527
|
+
seek: seek,
|
|
28528
|
+
rate: rate,
|
|
28529
|
+
stop: stop,
|
|
28530
|
+
pause: pause,
|
|
28531
|
+
resume: resume,
|
|
28532
|
+
playTrack: playTrack,
|
|
28533
|
+
stopTrack: stopTrack,
|
|
28534
|
+
pauseTrack: pauseTrack,
|
|
28535
|
+
resumeTrack: resumeTrack,
|
|
28536
|
+
getCurrentTrack: getCurrentTrack,
|
|
28537
|
+
setVolume: setVolume,
|
|
28538
|
+
getVolume: getVolume,
|
|
28539
|
+
mute: mute,
|
|
28540
|
+
unmute: unmute,
|
|
28541
|
+
muteAll: muteAll,
|
|
28542
|
+
unmuteAll: unmuteAll,
|
|
28543
|
+
muted: muted,
|
|
28544
|
+
unload: unload,
|
|
28545
|
+
unloadAll: unloadAll
|
|
27516
28546
|
});
|
|
27517
28547
|
|
|
27518
28548
|
/**
|
|
@@ -27669,8 +28699,8 @@ let swipeEnabled = true;
|
|
|
27669
28699
|
*/
|
|
27670
28700
|
function _disableSwipeFn(e) {
|
|
27671
28701
|
e.preventDefault();
|
|
27672
|
-
if (typeof
|
|
27673
|
-
|
|
28702
|
+
if (typeof globalThis.scroll === "function") {
|
|
28703
|
+
globalThis.scroll(0, 0);
|
|
27674
28704
|
}
|
|
27675
28705
|
return false;
|
|
27676
28706
|
}
|
|
@@ -27685,24 +28715,27 @@ function _domReady() {
|
|
|
27685
28715
|
// Make sure that the DOM is not already loaded
|
|
27686
28716
|
if (!isReady) {
|
|
27687
28717
|
// be sure document.body is there
|
|
27688
|
-
if (!document.body) {
|
|
28718
|
+
if (!device.nodeJS && !document.body) {
|
|
27689
28719
|
return setTimeout(_domReady, 13);
|
|
27690
28720
|
}
|
|
27691
28721
|
|
|
27692
28722
|
// clean up loading event
|
|
27693
|
-
if (document.removeEventListener) {
|
|
27694
|
-
document.removeEventListener(
|
|
28723
|
+
if (typeof globalThis.document !== "undefined" && typeof globalThis.document.removeEventListener === "function") {
|
|
28724
|
+
globalThis.document.removeEventListener(
|
|
27695
28725
|
"DOMContentLoaded",
|
|
27696
28726
|
this._domReady,
|
|
27697
28727
|
false
|
|
27698
28728
|
);
|
|
27699
28729
|
}
|
|
27700
|
-
|
|
27701
|
-
|
|
28730
|
+
|
|
28731
|
+
if (typeof globalThis.removeEventListener === "function") {
|
|
28732
|
+
// remove the event on globalThis.onload (always added in `onReady`)
|
|
28733
|
+
globalThis.removeEventListener("load", _domReady, false);
|
|
28734
|
+
}
|
|
27702
28735
|
|
|
27703
28736
|
// execute all callbacks
|
|
27704
28737
|
while (readyList.length) {
|
|
27705
|
-
readyList.shift().call(
|
|
28738
|
+
readyList.shift().call(globalThis, []);
|
|
27706
28739
|
}
|
|
27707
28740
|
|
|
27708
28741
|
// Remember that the DOM is ready
|
|
@@ -27740,7 +28773,7 @@ function _detectDevice() {
|
|
|
27740
28773
|
device.BlackBerry ||
|
|
27741
28774
|
device.Kindle || false;
|
|
27742
28775
|
// ejecta
|
|
27743
|
-
device.ejecta = (typeof
|
|
28776
|
+
device.ejecta = (typeof globalThis.ejecta !== "undefined");
|
|
27744
28777
|
// Wechat
|
|
27745
28778
|
device.isWeixin = /MicroMessenger/i.test(device.ua);
|
|
27746
28779
|
}
|
|
@@ -27760,46 +28793,44 @@ function _checkCapabilities() {
|
|
|
27760
28793
|
}
|
|
27761
28794
|
|
|
27762
28795
|
// Touch/Gesture Event feature detection
|
|
27763
|
-
device.TouchEvent = !!("ontouchstart" in
|
|
27764
|
-
device.PointerEvent = !!
|
|
27765
|
-
|
|
28796
|
+
device.TouchEvent = !!("ontouchstart" in globalThis);
|
|
28797
|
+
device.PointerEvent = !!globalThis.PointerEvent;
|
|
28798
|
+
globalThis.gesture = prefixed("gesture");
|
|
27766
28799
|
|
|
27767
28800
|
// detect touch capabilities
|
|
27768
28801
|
device.touch = device.TouchEvent || device.PointerEvent;
|
|
27769
28802
|
|
|
27770
28803
|
// max amount of touch points ; always at least return 1 (e.g. headless chrome will return 0)
|
|
27771
|
-
device.maxTouchPoints = device.touch ? (device.PointerEvent ? navigator.maxTouchPoints || 1 : 10) : 1;
|
|
28804
|
+
device.maxTouchPoints = device.touch ? (device.PointerEvent ? globalThis.navigator.maxTouchPoints || 1 : 10) : 1;
|
|
27772
28805
|
|
|
27773
28806
|
// detect wheel event support
|
|
27774
28807
|
// Modern browsers support "wheel", Webkit and IE support at least "mousewheel
|
|
27775
|
-
device.wheel =
|
|
28808
|
+
device.wheel = typeof globalThis.document !== "undefined" && "onwheel" in globalThis.document.createElement("div");
|
|
27776
28809
|
|
|
27777
28810
|
// pointerlock detection (pointerLockElement can be null when the feature is supported)
|
|
27778
|
-
device.hasPointerLockSupport = typeof document.pointerLockElement !== "undefined";
|
|
28811
|
+
device.hasPointerLockSupport = typeof globalThis.document !== "undefined" && typeof globalThis.document.pointerLockElement !== "undefined";
|
|
27779
28812
|
|
|
27780
28813
|
// device orientation and motion detection
|
|
27781
|
-
device.hasDeviceOrientation = !!
|
|
27782
|
-
device.hasAccelerometer = !!
|
|
28814
|
+
device.hasDeviceOrientation = !!globalThis.DeviceOrientationEvent;
|
|
28815
|
+
device.hasAccelerometer = !!globalThis.DeviceMotionEvent;
|
|
27783
28816
|
|
|
27784
28817
|
// support the ScreenOrientation API
|
|
27785
28818
|
device.ScreenOrientation = (typeof screen !== "undefined") &&
|
|
27786
28819
|
(typeof screen.orientation !== "undefined");
|
|
27787
28820
|
|
|
27788
28821
|
// fullscreen api detection & polyfill when possible
|
|
27789
|
-
device.hasFullscreenSupport = prefixed("fullscreenEnabled", document) ||
|
|
27790
|
-
document.mozFullScreenEnabled;
|
|
28822
|
+
device.hasFullscreenSupport = typeof globalThis.document !== "undefined" && (prefixed("fullscreenEnabled", globalThis.document) || globalThis.document.mozFullScreenEnabled);
|
|
27791
28823
|
|
|
27792
|
-
|
|
27793
|
-
|
|
28824
|
+
if (device.hasFullscreenSupport === true) {
|
|
28825
|
+
globalThis.document.exitFullscreen = typeof globalThis.document !== "undefined" && (prefixed("cancelFullScreen", globalThis.document) || prefixed("exitFullscreen", globalThis.document));
|
|
28826
|
+
}
|
|
27794
28827
|
|
|
27795
|
-
// vibration API poyfill
|
|
27796
|
-
navigator.vibrate = prefixed("vibrate", navigator);
|
|
27797
28828
|
|
|
27798
28829
|
// web Audio detection
|
|
27799
|
-
device.hasWebAudio = !!(
|
|
28830
|
+
device.hasWebAudio = !!(globalThis.AudioContext || globalThis.webkitAudioContext);
|
|
27800
28831
|
|
|
27801
28832
|
try {
|
|
27802
|
-
device.localStorage = !!
|
|
28833
|
+
device.localStorage = !!globalThis.localStorage;
|
|
27803
28834
|
} catch (e) {
|
|
27804
28835
|
// the above generates an exception when cookies are blocked
|
|
27805
28836
|
device.localStorage = false;
|
|
@@ -27809,75 +28840,78 @@ function _checkCapabilities() {
|
|
|
27809
28840
|
// some browser (e.g. Safari) implements WebGL1 and WebGL2 contexts only
|
|
27810
28841
|
// https://bugzilla.mozilla.org/show_bug.cgi?id=801176
|
|
27811
28842
|
device.OffscreenCanvas =
|
|
27812
|
-
(typeof
|
|
28843
|
+
(typeof globalThis.OffscreenCanvas !== "undefined") &&
|
|
27813
28844
|
((new OffscreenCanvas(0, 0).getContext( "2d" )) !== null);
|
|
27814
28845
|
} catch (e) {
|
|
27815
28846
|
device.OffscreenCanvas = false;
|
|
27816
28847
|
}
|
|
27817
28848
|
|
|
27818
|
-
|
|
27819
|
-
|
|
27820
|
-
|
|
27821
|
-
|
|
27822
|
-
|
|
27823
|
-
|
|
27824
|
-
|
|
27825
|
-
|
|
27826
|
-
|
|
27827
|
-
|
|
27828
|
-
|
|
27829
|
-
|
|
27830
|
-
|
|
27831
|
-
|
|
27832
|
-
|
|
27833
|
-
|
|
27834
|
-
|
|
27835
|
-
|
|
27836
|
-
|
|
27837
|
-
device.
|
|
27838
|
-
|
|
27839
|
-
|
|
27840
|
-
|
|
27841
|
-
|
|
27842
|
-
|
|
27843
|
-
|
|
27844
|
-
|
|
27845
|
-
|
|
27846
|
-
hidden
|
|
27847
|
-
|
|
27848
|
-
|
|
27849
|
-
|
|
27850
|
-
|
|
27851
|
-
|
|
27852
|
-
|
|
27853
|
-
|
|
27854
|
-
|
|
27855
|
-
|
|
27856
|
-
|
|
27857
|
-
|
|
27858
|
-
|
|
27859
|
-
|
|
27860
|
-
|
|
27861
|
-
//
|
|
27862
|
-
|
|
27863
|
-
|
|
27864
|
-
|
|
27865
|
-
|
|
27866
|
-
|
|
27867
|
-
|
|
27868
|
-
|
|
27869
|
-
|
|
27870
|
-
|
|
27871
|
-
|
|
27872
|
-
|
|
27873
|
-
|
|
27874
|
-
|
|
27875
|
-
|
|
27876
|
-
|
|
28849
|
+
if (typeof globalThis.addEventListener === "function") {
|
|
28850
|
+
// set pause/stop action on losing focus
|
|
28851
|
+
globalThis.addEventListener("blur", function () {
|
|
28852
|
+
if (device.stopOnBlur) {
|
|
28853
|
+
state.stop(true);
|
|
28854
|
+
}
|
|
28855
|
+
if (device.pauseOnBlur) {
|
|
28856
|
+
state.pause(true);
|
|
28857
|
+
}
|
|
28858
|
+
}, false);
|
|
28859
|
+
// set restart/resume action on gaining focus
|
|
28860
|
+
globalThis.addEventListener("focus", function () {
|
|
28861
|
+
if (device.stopOnBlur) {
|
|
28862
|
+
state.restart(true);
|
|
28863
|
+
}
|
|
28864
|
+
if (device.resumeOnFocus) {
|
|
28865
|
+
state.resume(true);
|
|
28866
|
+
}
|
|
28867
|
+
// force focus if autofocus is on
|
|
28868
|
+
if (device.autoFocus) {
|
|
28869
|
+
device.focus();
|
|
28870
|
+
}
|
|
28871
|
+
}, false);
|
|
28872
|
+
}
|
|
28873
|
+
|
|
28874
|
+
if (typeof globalThis.document !== "undefined") {
|
|
28875
|
+
// Set the name of the hidden property and the change event for visibility
|
|
28876
|
+
var hidden, visibilityChange;
|
|
28877
|
+
if (typeof globalThis.document.hidden !== "undefined") {
|
|
28878
|
+
// Opera 12.10 and Firefox 18 and later support
|
|
28879
|
+
hidden = "hidden";
|
|
28880
|
+
visibilityChange = "visibilitychange";
|
|
28881
|
+
} else if (typeof globalThis.document.mozHidden !== "undefined") {
|
|
28882
|
+
hidden = "mozHidden";
|
|
28883
|
+
visibilityChange = "mozvisibilitychange";
|
|
28884
|
+
} else if (typeof globalThis.document.msHidden !== "undefined") {
|
|
28885
|
+
hidden = "msHidden";
|
|
28886
|
+
visibilityChange = "msvisibilitychange";
|
|
28887
|
+
} else if (typeof globalThis.document.webkitHidden !== "undefined") {
|
|
28888
|
+
hidden = "webkitHidden";
|
|
28889
|
+
visibilityChange = "webkitvisibilitychange";
|
|
28890
|
+
}
|
|
28891
|
+
|
|
28892
|
+
// register on the event if supported
|
|
28893
|
+
if (typeof (visibilityChange) === "string") {
|
|
28894
|
+
// add the corresponding event listener
|
|
28895
|
+
globalThis.document.addEventListener(visibilityChange,
|
|
28896
|
+
function () {
|
|
28897
|
+
if (globalThis.document[hidden]) {
|
|
28898
|
+
if (device.stopOnBlur) {
|
|
28899
|
+
state.stop(true);
|
|
28900
|
+
}
|
|
28901
|
+
if (device.pauseOnBlur) {
|
|
28902
|
+
state.pause(true);
|
|
28903
|
+
}
|
|
28904
|
+
} else {
|
|
28905
|
+
if (device.stopOnBlur) {
|
|
28906
|
+
state.restart(true);
|
|
28907
|
+
}
|
|
28908
|
+
if (device.resumeOnFocus) {
|
|
28909
|
+
state.resume(true);
|
|
28910
|
+
}
|
|
27877
28911
|
}
|
|
27878
|
-
}
|
|
27879
|
-
|
|
27880
|
-
|
|
28912
|
+
}, false
|
|
28913
|
+
);
|
|
28914
|
+
}
|
|
27881
28915
|
}
|
|
27882
28916
|
}
|
|
27883
28917
|
|
|
@@ -27897,7 +28931,7 @@ let device = {
|
|
|
27897
28931
|
* @name ua
|
|
27898
28932
|
* @memberof device
|
|
27899
28933
|
*/
|
|
27900
|
-
ua : navigator.userAgent,
|
|
28934
|
+
ua : typeof globalThis.navigator !== "undefined" ? globalThis.navigator.userAgent : "",
|
|
27901
28935
|
|
|
27902
28936
|
/**
|
|
27903
28937
|
* Browser Local Storage capabilities <br>
|
|
@@ -27971,7 +29005,7 @@ let device = {
|
|
|
27971
29005
|
* @name nativeBase64
|
|
27972
29006
|
* @memberof device
|
|
27973
29007
|
*/
|
|
27974
|
-
nativeBase64 : (typeof(
|
|
29008
|
+
nativeBase64 : (typeof(globalThis.atob) === "function"),
|
|
27975
29009
|
|
|
27976
29010
|
/**
|
|
27977
29011
|
* Return the maximum number of simultaneous touch contact points are supported by the current device.
|
|
@@ -28050,24 +29084,33 @@ let device = {
|
|
|
28050
29084
|
*/
|
|
28051
29085
|
linux : false,
|
|
28052
29086
|
|
|
28053
|
-
|
|
28054
|
-
|
|
28055
|
-
|
|
28056
|
-
|
|
28057
|
-
|
|
28058
|
-
|
|
28059
|
-
|
|
28060
|
-
|
|
29087
|
+
/**
|
|
29088
|
+
* equals to true if the game is running under Ejecta.
|
|
29089
|
+
* @type {boolean}
|
|
29090
|
+
* @readonly
|
|
29091
|
+
* @see http://impactjs.com/ejecta
|
|
29092
|
+
* @name ejecta
|
|
29093
|
+
* @memberof device
|
|
29094
|
+
*/
|
|
28061
29095
|
ejecta : false,
|
|
28062
29096
|
|
|
28063
29097
|
/**
|
|
28064
|
-
* equals to true if the
|
|
29098
|
+
* equals to true if the is running under Wechat.
|
|
28065
29099
|
* @type {boolean}
|
|
28066
29100
|
* @readonly
|
|
28067
29101
|
* @name isWeixin
|
|
28068
29102
|
* @memberof device
|
|
28069
29103
|
*/
|
|
28070
|
-
|
|
29104
|
+
isWeixin : false,
|
|
29105
|
+
|
|
29106
|
+
/**
|
|
29107
|
+
* equals to true if running under node.js
|
|
29108
|
+
* @type {boolean}
|
|
29109
|
+
* @readonly
|
|
29110
|
+
* @name nodeJS
|
|
29111
|
+
* @memberof device
|
|
29112
|
+
*/
|
|
29113
|
+
nodeJS : (typeof process !== "undefined") && (process.release.name === "node"),
|
|
28071
29114
|
|
|
28072
29115
|
/**
|
|
28073
29116
|
* equals to true if the device is running on ChromeOS.
|
|
@@ -28182,7 +29225,7 @@ let device = {
|
|
|
28182
29225
|
* @name language
|
|
28183
29226
|
* @memberof device
|
|
28184
29227
|
*/
|
|
28185
|
-
language : navigator.language || navigator.browserLanguage || navigator.userLanguage || "en",
|
|
29228
|
+
language : typeof globalThis.navigator !== "undefined" ? globalThis.navigator.language || globalThis.navigator.browserLanguage || globalThis.navigator.userLanguage || "en" : "en",
|
|
28186
29229
|
|
|
28187
29230
|
/**
|
|
28188
29231
|
* Specify whether to pause the game when losing focus
|
|
@@ -28274,7 +29317,7 @@ let device = {
|
|
|
28274
29317
|
// If the DOM is already ready
|
|
28275
29318
|
if (isReady) {
|
|
28276
29319
|
// Execute the function immediately
|
|
28277
|
-
fn.call(
|
|
29320
|
+
fn.call(globalThis, []);
|
|
28278
29321
|
}
|
|
28279
29322
|
else {
|
|
28280
29323
|
// Add the function to the wait list
|
|
@@ -28283,17 +29326,17 @@ let device = {
|
|
|
28283
29326
|
// attach listeners if not yet done
|
|
28284
29327
|
if (!readyBound) {
|
|
28285
29328
|
// directly call domReady if document is already "ready"
|
|
28286
|
-
if (document.readyState === "complete") {
|
|
29329
|
+
if (device.nodeJS === true || (typeof globalThis.document !== "undefined" && globalThis.document.readyState === "complete")) {
|
|
28287
29330
|
// defer the fn call to ensure our script is fully loaded
|
|
28288
|
-
|
|
29331
|
+
globalThis.setTimeout(_domReady, 0);
|
|
28289
29332
|
}
|
|
28290
29333
|
else {
|
|
28291
|
-
if (document.addEventListener) {
|
|
29334
|
+
if (typeof globalThis.document !== "undefined" && typeof globalThis.document.addEventListener === "function") {
|
|
28292
29335
|
// Use the handy event callback
|
|
28293
|
-
document.addEventListener("DOMContentLoaded", _domReady, false);
|
|
29336
|
+
globalThis.document.addEventListener("DOMContentLoaded", _domReady, false);
|
|
28294
29337
|
}
|
|
28295
|
-
// A fallback to
|
|
28296
|
-
|
|
29338
|
+
// A fallback to globalThis.onload, that will always work
|
|
29339
|
+
globalThis.addEventListener("load", _domReady, false);
|
|
28297
29340
|
}
|
|
28298
29341
|
readyBound = true;
|
|
28299
29342
|
}
|
|
@@ -28308,11 +29351,11 @@ let device = {
|
|
|
28308
29351
|
enableSwipe(enable) {
|
|
28309
29352
|
if (enable !== false) {
|
|
28310
29353
|
if (swipeEnabled === false) {
|
|
28311
|
-
|
|
29354
|
+
globalThis.document.removeEventListener("touchmove", _disableSwipeFn, false);
|
|
28312
29355
|
swipeEnabled = true;
|
|
28313
29356
|
}
|
|
28314
29357
|
} else if (swipeEnabled === true) {
|
|
28315
|
-
|
|
29358
|
+
globalThis.document.addEventListener("touchmove", _disableSwipeFn, false);
|
|
28316
29359
|
swipeEnabled = false;
|
|
28317
29360
|
}
|
|
28318
29361
|
},
|
|
@@ -28366,7 +29409,7 @@ let device = {
|
|
|
28366
29409
|
var PORTRAIT = "portrait";
|
|
28367
29410
|
var LANDSCAPE = "landscape";
|
|
28368
29411
|
|
|
28369
|
-
var screen =
|
|
29412
|
+
var screen = globalThis.screen;
|
|
28370
29413
|
|
|
28371
29414
|
// first try using "standard" values
|
|
28372
29415
|
if (this.ScreenOrientation === true) {
|
|
@@ -28381,12 +29424,12 @@ let device = {
|
|
|
28381
29424
|
}
|
|
28382
29425
|
|
|
28383
29426
|
// check using the deprecated API
|
|
28384
|
-
if (typeof
|
|
28385
|
-
return (Math.abs(
|
|
29427
|
+
if (typeof globalThis.orientation === "number") {
|
|
29428
|
+
return (Math.abs(globalThis.orientation) === 90) ? LANDSCAPE : PORTRAIT;
|
|
28386
29429
|
}
|
|
28387
29430
|
|
|
28388
29431
|
// fallback to window size check
|
|
28389
|
-
return (
|
|
29432
|
+
return (globalThis.outerWidth > globalThis.outerHeight) ? LANDSCAPE : PORTRAIT;
|
|
28390
29433
|
},
|
|
28391
29434
|
|
|
28392
29435
|
/**
|
|
@@ -28398,7 +29441,7 @@ let device = {
|
|
|
28398
29441
|
* @returns {boolean} true if the orientation was unsuccessfully locked
|
|
28399
29442
|
*/
|
|
28400
29443
|
lockOrientation(orientation) {
|
|
28401
|
-
var screen =
|
|
29444
|
+
var screen = globalThis.screen;
|
|
28402
29445
|
if (typeof screen !== "undefined") {
|
|
28403
29446
|
var _lockOrientation = prefixed("lockOrientation", screen);
|
|
28404
29447
|
if (typeof _lockOrientation !== "undefined") {
|
|
@@ -28416,7 +29459,7 @@ let device = {
|
|
|
28416
29459
|
* @returns {boolean} true if the orientation was unsuccessfully unlocked
|
|
28417
29460
|
*/
|
|
28418
29461
|
unlockOrientation() {
|
|
28419
|
-
var screen =
|
|
29462
|
+
var screen = globalThis.screen;
|
|
28420
29463
|
if (typeof screen !== "undefined") {
|
|
28421
29464
|
var _unlockOrientation = prefixed("unlockOrientation", screen);
|
|
28422
29465
|
if (typeof _unlockOrientation !== "undefined") {
|
|
@@ -28515,8 +29558,8 @@ let device = {
|
|
|
28515
29558
|
if (typeof element === "object" && element !== document.body && typeof element.getBoundingClientRect !== "undefined") {
|
|
28516
29559
|
return element.getBoundingClientRect();
|
|
28517
29560
|
} else {
|
|
28518
|
-
_domRect.width = _domRect.right =
|
|
28519
|
-
_domRect.height = _domRect.bottom =
|
|
29561
|
+
_domRect.width = _domRect.right = globalThis.innerWidth;
|
|
29562
|
+
_domRect.height = _domRect.bottom = globalThis.innerHeight;
|
|
28520
29563
|
return _domRect;
|
|
28521
29564
|
} },
|
|
28522
29565
|
|
|
@@ -28547,7 +29590,7 @@ let device = {
|
|
|
28547
29590
|
stencil: true,
|
|
28548
29591
|
failIfMajorPerformanceCaveat : options.failIfMajorPerformanceCaveat
|
|
28549
29592
|
};
|
|
28550
|
-
_supported = !! (
|
|
29593
|
+
_supported = !! (globalThis.WebGLRenderingContext && (canvas.getContext("webgl", ctxOptions) || canvas.getContext("experimental-webgl", ctxOptions)));
|
|
28551
29594
|
} catch (e) {
|
|
28552
29595
|
_supported = false;
|
|
28553
29596
|
}
|
|
@@ -28582,8 +29625,8 @@ let device = {
|
|
|
28582
29625
|
* }
|
|
28583
29626
|
*/
|
|
28584
29627
|
focus() {
|
|
28585
|
-
if (typeof (
|
|
28586
|
-
|
|
29628
|
+
if (typeof (globalThis.focus) === "function") {
|
|
29629
|
+
globalThis.focus();
|
|
28587
29630
|
}
|
|
28588
29631
|
},
|
|
28589
29632
|
|
|
@@ -28637,13 +29680,13 @@ let device = {
|
|
|
28637
29680
|
.then(response => {
|
|
28638
29681
|
if (response === "granted") {
|
|
28639
29682
|
// add a listener for the devicemotion event
|
|
28640
|
-
|
|
29683
|
+
globalThis.addEventListener("devicemotion", this.onDeviceMotion, false);
|
|
28641
29684
|
accelInitialized = true;
|
|
28642
29685
|
}
|
|
28643
29686
|
}).catch(console.error);
|
|
28644
29687
|
} else {
|
|
28645
29688
|
// add a listener for the devicemotion event
|
|
28646
|
-
|
|
29689
|
+
globalThis.addEventListener("devicemotion", this.onDeviceMotion, false);
|
|
28647
29690
|
accelInitialized = true;
|
|
28648
29691
|
}
|
|
28649
29692
|
}
|
|
@@ -28657,7 +29700,7 @@ let device = {
|
|
|
28657
29700
|
unwatchAccelerometer() {
|
|
28658
29701
|
if (accelInitialized) {
|
|
28659
29702
|
// remove the listener for the devicemotion event
|
|
28660
|
-
|
|
29703
|
+
globalThis.removeEventListener("devicemotion", this.onDeviceMotion, false);
|
|
28661
29704
|
accelInitialized = false;
|
|
28662
29705
|
}
|
|
28663
29706
|
},
|
|
@@ -28687,12 +29730,12 @@ let device = {
|
|
|
28687
29730
|
DeviceOrientationEvent.requestPermission()
|
|
28688
29731
|
.then(response => {
|
|
28689
29732
|
if (response === "granted") {
|
|
28690
|
-
|
|
29733
|
+
globalThis.addEventListener("deviceorientation", this.onDeviceRotate, false);
|
|
28691
29734
|
deviceOrientationInitialized = true;
|
|
28692
29735
|
}
|
|
28693
29736
|
}).catch(console.error);
|
|
28694
29737
|
} else {
|
|
28695
|
-
|
|
29738
|
+
globalThis.addEventListener("deviceorientation", this.onDeviceRotate, false);
|
|
28696
29739
|
deviceOrientationInitialized = true;
|
|
28697
29740
|
}
|
|
28698
29741
|
}
|
|
@@ -28705,7 +29748,7 @@ let device = {
|
|
|
28705
29748
|
*/
|
|
28706
29749
|
unwatchDeviceOrientation() {
|
|
28707
29750
|
if (deviceOrientationInitialized) {
|
|
28708
|
-
|
|
29751
|
+
globalThis.removeEventListener("deviceorientation", this.onDeviceRotate, false);
|
|
28709
29752
|
deviceOrientationInitialized = false;
|
|
28710
29753
|
}
|
|
28711
29754
|
},
|
|
@@ -28728,8 +29771,8 @@ let device = {
|
|
|
28728
29771
|
* me.device.vibrate(0);
|
|
28729
29772
|
*/
|
|
28730
29773
|
vibrate(pattern) {
|
|
28731
|
-
if (navigator.vibrate) {
|
|
28732
|
-
navigator.vibrate(pattern);
|
|
29774
|
+
if (typeof globalThis.navigator !== "undefined" && typeof globalThis.navigator.vibrate === "function") {
|
|
29775
|
+
globalThis.navigator.vibrate(pattern);
|
|
28733
29776
|
}
|
|
28734
29777
|
}
|
|
28735
29778
|
|
|
@@ -28749,7 +29792,7 @@ Object.defineProperty(device, "devicePixelRatio", {
|
|
|
28749
29792
|
* @ignore
|
|
28750
29793
|
*/
|
|
28751
29794
|
get: function () {
|
|
28752
|
-
return (
|
|
29795
|
+
return (globalThis.devicePixelRatio || 1);
|
|
28753
29796
|
}
|
|
28754
29797
|
});
|
|
28755
29798
|
|
|
@@ -29073,7 +30116,7 @@ class GLShader {
|
|
|
29073
30116
|
this.uniforms = extractUniforms(this.gl, this);
|
|
29074
30117
|
|
|
29075
30118
|
// destroy the shader on context lost (will be recreated on context restore)
|
|
29076
|
-
on(
|
|
30119
|
+
on(ONCONTEXT_LOST, this.destroy, this);
|
|
29077
30120
|
}
|
|
29078
30121
|
|
|
29079
30122
|
/**
|
|
@@ -29969,19 +31012,19 @@ class WebGLRenderer extends Renderer {
|
|
|
29969
31012
|
// Create a texture cache
|
|
29970
31013
|
this.cache = new TextureCache(this.maxTextures);
|
|
29971
31014
|
|
|
29972
|
-
// to simulate context lost and restore :
|
|
31015
|
+
// to simulate context lost and restore in WebGL:
|
|
29973
31016
|
// var ctx = me.video.renderer.context.getExtension('WEBGL_lose_context');
|
|
29974
31017
|
// ctx.loseContext()
|
|
29975
31018
|
this.getScreenCanvas().addEventListener("webglcontextlost", (e) => {
|
|
29976
31019
|
e.preventDefault();
|
|
29977
31020
|
this.isContextValid = false;
|
|
29978
|
-
emit(
|
|
31021
|
+
emit(ONCONTEXT_LOST, this);
|
|
29979
31022
|
}, false );
|
|
29980
31023
|
// ctx.restoreContext()
|
|
29981
31024
|
this.getScreenCanvas().addEventListener("webglcontextrestored", () => {
|
|
29982
31025
|
this.reset();
|
|
29983
31026
|
this.isContextValid = true;
|
|
29984
|
-
emit(
|
|
31027
|
+
emit(ONCONTEXT_RESTORED, this);
|
|
29985
31028
|
}, false );
|
|
29986
31029
|
}
|
|
29987
31030
|
|
|
@@ -30376,7 +31419,7 @@ class WebGLRenderer extends Renderer {
|
|
|
30376
31419
|
* <img src="images/normal-blendmode.png" width="510"/> <br>
|
|
30377
31420
|
* - "multiply" : the pixels of the top layer are multiplied with the corresponding pixel of the bottom layer. A darker picture is the result. <br>
|
|
30378
31421
|
* <img src="images/multiply-blendmode.png" width="510"/> <br>
|
|
30379
|
-
* - "lighter" : where both content overlap the color is determined by adding color values. <br>
|
|
31422
|
+
* - "additive or lighter" : where both content overlap the color is determined by adding color values. <br>
|
|
30380
31423
|
* <img src="images/lighter-blendmode.png" width="510"/> <br>
|
|
30381
31424
|
* - "screen" : The pixels are inverted, multiplied, and inverted again. A lighter picture is the result (opposite of multiply) <br>
|
|
30382
31425
|
* <img src="images/screen-blendmode.png" width="510"/> <br>
|
|
@@ -30384,7 +31427,7 @@ class WebGLRenderer extends Renderer {
|
|
|
30384
31427
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/globalCompositeOperation
|
|
30385
31428
|
* @memberof WebGLRenderer.prototype
|
|
30386
31429
|
* @function
|
|
30387
|
-
* @param {string} [mode="normal"] blend mode : "normal", "multiply", "lighter", "screen"
|
|
31430
|
+
* @param {string} [mode="normal"] blend mode : "normal", "multiply", "lighter", "additive", "screen"
|
|
30388
31431
|
* @param {WebGLRenderingContext} [gl]
|
|
30389
31432
|
*/
|
|
30390
31433
|
setBlendMode(mode = "normal", gl = this.gl) {
|
|
@@ -30400,6 +31443,7 @@ class WebGLRenderer extends Renderer {
|
|
|
30400
31443
|
break;
|
|
30401
31444
|
|
|
30402
31445
|
case "lighter" :
|
|
31446
|
+
case "additive" :
|
|
30403
31447
|
gl.blendFunc(gl.ONE, gl.ONE);
|
|
30404
31448
|
break;
|
|
30405
31449
|
|
|
@@ -31011,7 +32055,7 @@ var designHeight = 0;
|
|
|
31011
32055
|
|
|
31012
32056
|
// default video settings
|
|
31013
32057
|
var settings = {
|
|
31014
|
-
parent :
|
|
32058
|
+
parent : undefined,
|
|
31015
32059
|
renderer : 2, // AUTO
|
|
31016
32060
|
doubleBuffering : false,
|
|
31017
32061
|
autoScale : false,
|
|
@@ -31056,8 +32100,8 @@ function onresize() {
|
|
|
31056
32100
|
var canvasMaxWidth = Infinity;
|
|
31057
32101
|
var canvasMaxHeight = Infinity;
|
|
31058
32102
|
|
|
31059
|
-
if (
|
|
31060
|
-
var style =
|
|
32103
|
+
if (globalThis.getComputedStyle) {
|
|
32104
|
+
var style = globalThis.getComputedStyle(renderer.getScreenCanvas(), null);
|
|
31061
32105
|
canvasMaxWidth = parseInt(style.maxWidth, 10) || Infinity;
|
|
31062
32106
|
canvasMaxHeight = parseInt(style.maxHeight, 10) || Infinity;
|
|
31063
32107
|
}
|
|
@@ -31267,7 +32311,7 @@ function init(width, height, options) {
|
|
|
31267
32311
|
settings.zoomY = height * scaleRatio.y;
|
|
31268
32312
|
|
|
31269
32313
|
//add a channel for the onresize/onorientationchange event
|
|
31270
|
-
|
|
32314
|
+
globalThis.addEventListener(
|
|
31271
32315
|
"resize",
|
|
31272
32316
|
utils.function.throttle(
|
|
31273
32317
|
function (e) {
|
|
@@ -31277,7 +32321,7 @@ function init(width, height, options) {
|
|
|
31277
32321
|
);
|
|
31278
32322
|
|
|
31279
32323
|
// Screen Orientation API
|
|
31280
|
-
|
|
32324
|
+
globalThis.addEventListener(
|
|
31281
32325
|
"orientationchange",
|
|
31282
32326
|
function (e) {
|
|
31283
32327
|
emit(WINDOW_ONORIENTATION_CHANGE, e);
|
|
@@ -31285,7 +32329,7 @@ function init(width, height, options) {
|
|
|
31285
32329
|
false
|
|
31286
32330
|
);
|
|
31287
32331
|
// pre-fixed implementation on mozzila
|
|
31288
|
-
|
|
32332
|
+
globalThis.addEventListener(
|
|
31289
32333
|
"onmozorientationchange",
|
|
31290
32334
|
function (e) {
|
|
31291
32335
|
emit(WINDOW_ONORIENTATION_CHANGE, e);
|
|
@@ -31294,13 +32338,13 @@ function init(width, height, options) {
|
|
|
31294
32338
|
);
|
|
31295
32339
|
|
|
31296
32340
|
if (device$1.ScreenOrientation === true) {
|
|
31297
|
-
|
|
32341
|
+
globalThis.screen.orientation.onchange = function (e) {
|
|
31298
32342
|
emit(WINDOW_ONORIENTATION_CHANGE, e);
|
|
31299
32343
|
};
|
|
31300
32344
|
}
|
|
31301
32345
|
|
|
31302
32346
|
// Automatically update relative canvas position on scroll
|
|
31303
|
-
|
|
32347
|
+
globalThis.addEventListener("scroll", utils.function.throttle(
|
|
31304
32348
|
function (e) {
|
|
31305
32349
|
emit(WINDOW_ONSCROLL, e);
|
|
31306
32350
|
}, 100
|
|
@@ -31327,14 +32371,14 @@ function init(width, height, options) {
|
|
|
31327
32371
|
}
|
|
31328
32372
|
|
|
31329
32373
|
// add our canvas (default to document.body if settings.parent is undefined)
|
|
31330
|
-
parent = device$1.getElement(settings.parent);
|
|
32374
|
+
parent = device$1.getElement(typeof settings.parent !== "undefined" ? settings.parent : document.body);
|
|
31331
32375
|
parent.appendChild(renderer.getScreenCanvas());
|
|
31332
32376
|
|
|
31333
32377
|
// trigger an initial resize();
|
|
31334
32378
|
onresize();
|
|
31335
32379
|
|
|
31336
32380
|
// add an observer to detect when the dom tree is modified
|
|
31337
|
-
if ("MutationObserver" in
|
|
32381
|
+
if ("MutationObserver" in globalThis) {
|
|
31338
32382
|
// Create an observer instance linked to the callback function
|
|
31339
32383
|
var observer = new MutationObserver(onresize.bind(this));
|
|
31340
32384
|
|
|
@@ -31353,7 +32397,7 @@ function init(width, height, options) {
|
|
|
31353
32397
|
renderType + " renderer" + gpu_renderer + " | " +
|
|
31354
32398
|
audioType + " | " +
|
|
31355
32399
|
"pixel ratio " + device$1.devicePixelRatio + " | " +
|
|
31356
|
-
(device$1.isMobile ? "mobile" : "desktop") + " | " +
|
|
32400
|
+
(device$1.nodeJS ? "node.js" : device$1.isMobile ? "mobile" : "desktop") + " | " +
|
|
31357
32401
|
device$1.getScreenOrientation() + " | " +
|
|
31358
32402
|
device$1.language
|
|
31359
32403
|
);
|
|
@@ -31440,17 +32484,17 @@ function scale(x, y) {
|
|
|
31440
32484
|
}
|
|
31441
32485
|
|
|
31442
32486
|
var video = /*#__PURE__*/Object.freeze({
|
|
31443
|
-
|
|
31444
|
-
|
|
31445
|
-
|
|
31446
|
-
|
|
31447
|
-
|
|
31448
|
-
|
|
31449
|
-
|
|
31450
|
-
|
|
31451
|
-
|
|
31452
|
-
|
|
31453
|
-
|
|
32487
|
+
__proto__: null,
|
|
32488
|
+
CANVAS: CANVAS,
|
|
32489
|
+
WEBGL: WEBGL,
|
|
32490
|
+
AUTO: AUTO,
|
|
32491
|
+
get parent () { return parent; },
|
|
32492
|
+
scaleRatio: scaleRatio,
|
|
32493
|
+
get renderer () { return renderer; },
|
|
32494
|
+
init: init,
|
|
32495
|
+
createCanvas: createCanvas,
|
|
32496
|
+
getParent: getParent,
|
|
32497
|
+
scale: scale
|
|
31454
32498
|
});
|
|
31455
32499
|
|
|
31456
32500
|
/**
|
|
@@ -31549,12 +32593,17 @@ var utils = {
|
|
|
31549
32593
|
var hash = {};
|
|
31550
32594
|
|
|
31551
32595
|
if (typeof url === "undefined") {
|
|
31552
|
-
|
|
32596
|
+
if (typeof globalThis.document !== "undefined") {
|
|
32597
|
+
var location = globalThis.document.location;
|
|
31553
32598
|
|
|
31554
|
-
|
|
31555
|
-
|
|
32599
|
+
if (location && location.hash) {
|
|
32600
|
+
url = location.hash;
|
|
32601
|
+
} else {
|
|
32602
|
+
// No "document.location" exist for Wechat mini game platform.
|
|
32603
|
+
return hash;
|
|
32604
|
+
}
|
|
31556
32605
|
} else {
|
|
31557
|
-
//
|
|
32606
|
+
// "document" undefined on node.js
|
|
31558
32607
|
return hash;
|
|
31559
32608
|
}
|
|
31560
32609
|
} else {
|
|
@@ -31743,7 +32792,7 @@ var timer = {
|
|
|
31743
32792
|
*/
|
|
31744
32793
|
reset() {
|
|
31745
32794
|
// set to "now"
|
|
31746
|
-
last = now =
|
|
32795
|
+
last = now = globalThis.performance.now();
|
|
31747
32796
|
delta = 0;
|
|
31748
32797
|
// reset delta counting variables
|
|
31749
32798
|
framedelta = 0;
|
|
@@ -31882,23 +32931,23 @@ var x;
|
|
|
31882
32931
|
|
|
31883
32932
|
// standardized functions
|
|
31884
32933
|
// https://developer.mozilla.org/fr/docs/Web/API/Window/requestAnimationFrame
|
|
31885
|
-
var requestAnimationFrame =
|
|
31886
|
-
var cancelAnimationFrame =
|
|
32934
|
+
var requestAnimationFrame = globalThis.requestAnimationFrame;
|
|
32935
|
+
var cancelAnimationFrame = globalThis.cancelAnimationFrame;
|
|
31887
32936
|
|
|
31888
32937
|
// get prefixed rAF and cAF is standard one not supported
|
|
31889
32938
|
for (x = 0; x < vendors.length && !requestAnimationFrame; ++x) {
|
|
31890
|
-
requestAnimationFrame =
|
|
32939
|
+
requestAnimationFrame = globalThis[vendors[x] + "RequestAnimationFrame"];
|
|
31891
32940
|
}
|
|
31892
32941
|
for (x = 0; x < vendors.length && !cancelAnimationFrame; ++x) {
|
|
31893
|
-
cancelAnimationFrame =
|
|
31894
|
-
|
|
32942
|
+
cancelAnimationFrame = globalThis[vendors[x] + "CancelAnimationFrame"] ||
|
|
32943
|
+
globalThis[vendors[x] + "CancelRequestAnimationFrame"];
|
|
31895
32944
|
}
|
|
31896
32945
|
|
|
31897
32946
|
if (!requestAnimationFrame || !cancelAnimationFrame) {
|
|
31898
32947
|
requestAnimationFrame = function (callback) {
|
|
31899
|
-
var currTime =
|
|
32948
|
+
var currTime = globalThis.performance.now();
|
|
31900
32949
|
var timeToCall = Math.max(0, (1000 / timer$1.maxfps) - (currTime - lastTime));
|
|
31901
|
-
var id =
|
|
32950
|
+
var id = globalThis.setTimeout(function () {
|
|
31902
32951
|
callback(currTime + timeToCall);
|
|
31903
32952
|
}, timeToCall);
|
|
31904
32953
|
lastTime = currTime + timeToCall;
|
|
@@ -31906,12 +32955,12 @@ if (!requestAnimationFrame || !cancelAnimationFrame) {
|
|
|
31906
32955
|
};
|
|
31907
32956
|
|
|
31908
32957
|
cancelAnimationFrame = function (id) {
|
|
31909
|
-
|
|
32958
|
+
globalThis.clearTimeout(id);
|
|
31910
32959
|
};
|
|
31911
32960
|
|
|
31912
32961
|
// put back in global namespace
|
|
31913
|
-
|
|
31914
|
-
|
|
32962
|
+
globalThis.requestAnimationFrame = requestAnimationFrame;
|
|
32963
|
+
globalThis.cancelAnimationFrame = cancelAnimationFrame;
|
|
31915
32964
|
}
|
|
31916
32965
|
|
|
31917
32966
|
/**
|
|
@@ -31930,10 +32979,10 @@ class BasePlugin {
|
|
|
31930
32979
|
* this can be overridden by the plugin
|
|
31931
32980
|
* @public
|
|
31932
32981
|
* @type {string}
|
|
31933
|
-
* @default "10.
|
|
32982
|
+
* @default "10.7.1"
|
|
31934
32983
|
* @name plugin.Base#version
|
|
31935
32984
|
*/
|
|
31936
|
-
this.version = "10.
|
|
32985
|
+
this.version = "10.7.1";
|
|
31937
32986
|
}
|
|
31938
32987
|
}
|
|
31939
32988
|
|
|
@@ -33679,11 +34728,6 @@ class BitmapText extends Renderable {
|
|
|
33679
34728
|
this.floating = !!settings.floating;
|
|
33680
34729
|
}
|
|
33681
34730
|
|
|
33682
|
-
// resize if necessary
|
|
33683
|
-
if (typeof settings.size === "number" && settings.size !== 1.0) {
|
|
33684
|
-
this.resize(settings.size);
|
|
33685
|
-
}
|
|
33686
|
-
|
|
33687
34731
|
// apply given fillstyle
|
|
33688
34732
|
if (typeof settings.fillStyle !== "undefined") {
|
|
33689
34733
|
if (settings.fillStyle instanceof Color) {
|
|
@@ -33704,6 +34748,11 @@ class BitmapText extends Renderable {
|
|
|
33704
34748
|
// instance to text metrics functions
|
|
33705
34749
|
this.metrics = new TextMetrics(this);
|
|
33706
34750
|
|
|
34751
|
+
// resize if necessary
|
|
34752
|
+
if (typeof settings.size === "number" && settings.size !== 1.0) {
|
|
34753
|
+
this.resize(settings.size);
|
|
34754
|
+
}
|
|
34755
|
+
|
|
33707
34756
|
// set the text
|
|
33708
34757
|
this.setText(settings.text);
|
|
33709
34758
|
}
|
|
@@ -34307,7 +35356,7 @@ class ImageLayer extends Sprite {
|
|
|
34307
35356
|
this.repeat = settings.repeat || "repeat";
|
|
34308
35357
|
|
|
34309
35358
|
// on context lost, all previous textures are destroyed
|
|
34310
|
-
on(
|
|
35359
|
+
on(ONCONTEXT_RESTORED, this.createPattern, this);
|
|
34311
35360
|
}
|
|
34312
35361
|
|
|
34313
35362
|
/**
|
|
@@ -34508,7 +35557,7 @@ class ImageLayer extends Sprite {
|
|
|
34508
35557
|
destroy() {
|
|
34509
35558
|
push(this.ratio);
|
|
34510
35559
|
this.ratio = undefined;
|
|
34511
|
-
off(
|
|
35560
|
+
off(ONCONTEXT_RESTORED, this.createPattern);
|
|
34512
35561
|
super.destroy();
|
|
34513
35562
|
}
|
|
34514
35563
|
|
|
@@ -35352,143 +36401,63 @@ class DropTarget extends Renderable {
|
|
|
35352
36401
|
}
|
|
35353
36402
|
|
|
35354
36403
|
/**
|
|
35355
|
-
*
|
|
35356
|
-
*
|
|
35357
|
-
* @
|
|
35358
|
-
* @augments Container
|
|
35359
|
-
* @param {ParticleEmitter} emitter the emitter which owns this container
|
|
36404
|
+
* ParticleEmitterSettings contains the default settings for ParticleEmitter
|
|
36405
|
+
* @see ParticleEmitter
|
|
36406
|
+
* @namespace ParticleEmitterSettings
|
|
35360
36407
|
*/
|
|
35361
|
-
|
|
35362
|
-
class ParticleContainer extends Container {
|
|
35363
|
-
|
|
36408
|
+
const ParticleEmitterSettings = {
|
|
35364
36409
|
/**
|
|
35365
|
-
*
|
|
35366
|
-
|
|
35367
|
-
|
|
35368
|
-
|
|
35369
|
-
|
|
35370
|
-
viewport.pos.x,
|
|
35371
|
-
viewport.pos.y,
|
|
35372
|
-
viewport.width,
|
|
35373
|
-
viewport.height
|
|
35374
|
-
);
|
|
35375
|
-
|
|
35376
|
-
// don't sort the particles by z-index
|
|
35377
|
-
this.autoSort = false;
|
|
35378
|
-
|
|
35379
|
-
// count the updates
|
|
35380
|
-
this._updateCount = 0;
|
|
35381
|
-
|
|
35382
|
-
// internally store how much time was skipped when frames are skipped
|
|
35383
|
-
this._dt = 0;
|
|
35384
|
-
|
|
35385
|
-
// cache the emitter for later use
|
|
35386
|
-
this._emitter = emitter;
|
|
35387
|
-
|
|
35388
|
-
this.autoTransform = false;
|
|
35389
|
-
|
|
35390
|
-
this.anchorPoint.set(0, 0);
|
|
35391
|
-
|
|
35392
|
-
this.isKinematic = true;
|
|
35393
|
-
}
|
|
35394
|
-
|
|
35395
|
-
/**
|
|
35396
|
-
* @ignore
|
|
36410
|
+
* Width of the particle spawn area.
|
|
36411
|
+
* @type {number}
|
|
36412
|
+
* @name width
|
|
36413
|
+
* @memberof ParticleEmitterSettings
|
|
36414
|
+
* @default 1
|
|
35397
36415
|
*/
|
|
35398
|
-
|
|
35399
|
-
// skip frames if necessary
|
|
35400
|
-
if (++this._updateCount > this._emitter.framesToSkip) {
|
|
35401
|
-
this._updateCount = 0;
|
|
35402
|
-
}
|
|
35403
|
-
if (this._updateCount > 0) {
|
|
35404
|
-
this._dt += dt;
|
|
35405
|
-
return false;
|
|
35406
|
-
}
|
|
35407
|
-
|
|
35408
|
-
// apply skipped delta time
|
|
35409
|
-
dt += this._dt;
|
|
35410
|
-
this._dt = 0;
|
|
35411
|
-
|
|
35412
|
-
// Update particles and remove them if they are dead
|
|
35413
|
-
for (var i = this.children.length - 1; i >= 0; --i) {
|
|
35414
|
-
var particle = this.children[i];
|
|
35415
|
-
particle.inViewport = viewport.isVisible(particle, this.floating);
|
|
35416
|
-
if (!particle.update(dt)) {
|
|
35417
|
-
this.removeChildNow(particle);
|
|
35418
|
-
}
|
|
35419
|
-
}
|
|
35420
|
-
return true;
|
|
35421
|
-
}
|
|
36416
|
+
width : 1,
|
|
35422
36417
|
|
|
35423
36418
|
/**
|
|
35424
|
-
*
|
|
36419
|
+
* Height of the particle spawn area
|
|
36420
|
+
* @public
|
|
36421
|
+
* @type {number}
|
|
36422
|
+
* @name height
|
|
36423
|
+
* @memberof ParticleEmitterSettings
|
|
36424
|
+
* @default 1
|
|
35425
36425
|
*/
|
|
35426
|
-
|
|
35427
|
-
if (this.children.length > 0) {
|
|
35428
|
-
var context = renderer.getContext(),
|
|
35429
|
-
gco;
|
|
35430
|
-
// Check for additive draw
|
|
35431
|
-
if (this._emitter.textureAdditive) {
|
|
35432
|
-
gco = context.globalCompositeOperation;
|
|
35433
|
-
context.globalCompositeOperation = "lighter";
|
|
35434
|
-
}
|
|
36426
|
+
height : 1,
|
|
35435
36427
|
|
|
35436
|
-
super.draw(renderer, rect);
|
|
35437
|
-
|
|
35438
|
-
// Restore globalCompositeOperation
|
|
35439
|
-
if (this._emitter.textureAdditive) {
|
|
35440
|
-
context.globalCompositeOperation = gco;
|
|
35441
|
-
}
|
|
35442
|
-
}
|
|
35443
|
-
}
|
|
35444
|
-
}
|
|
35445
|
-
|
|
35446
|
-
// generate a default image for the particles
|
|
35447
|
-
var pixel = (function () {
|
|
35448
|
-
var canvas = createCanvas(1, 1);
|
|
35449
|
-
var context = canvas.getContext("2d");
|
|
35450
|
-
context.fillStyle = "#fff";
|
|
35451
|
-
context.fillRect(0, 0, 1, 1);
|
|
35452
|
-
return canvas;
|
|
35453
|
-
})();
|
|
35454
|
-
|
|
35455
|
-
/**
|
|
35456
|
-
* me.ParticleEmitterSettings contains the default settings for me.ParticleEmitter
|
|
35457
|
-
* @ignore
|
|
35458
|
-
* @class
|
|
35459
|
-
* @see ParticleEmitter
|
|
35460
|
-
*/
|
|
35461
|
-
var ParticleEmitterSettings = {
|
|
35462
36428
|
/**
|
|
35463
|
-
*
|
|
36429
|
+
* image used for particles texture
|
|
36430
|
+
* (by default melonJS will create an white 8x8 texture image)
|
|
35464
36431
|
* @public
|
|
35465
|
-
* @type {
|
|
35466
|
-
* @name
|
|
36432
|
+
* @type {HTMLCanvasElement}
|
|
36433
|
+
* @name image
|
|
35467
36434
|
* @memberof ParticleEmitterSettings
|
|
35468
|
-
* @default
|
|
36435
|
+
* @default undefined
|
|
36436
|
+
* @see ParticleEmitterSettings.textureSize
|
|
35469
36437
|
*/
|
|
35470
|
-
|
|
36438
|
+
image : undefined,
|
|
35471
36439
|
|
|
35472
36440
|
/**
|
|
35473
|
-
*
|
|
36441
|
+
* default texture size used for particles if no image is specified
|
|
36442
|
+
* (by default melonJS will create an white 8x8 texture image)
|
|
35474
36443
|
* @public
|
|
35475
36444
|
* @type {number}
|
|
35476
|
-
* @name
|
|
36445
|
+
* @name textureSize
|
|
35477
36446
|
* @memberof ParticleEmitterSettings
|
|
35478
|
-
* @default
|
|
36447
|
+
* @default 8
|
|
36448
|
+
* @see ParticleEmitterSettings.image
|
|
35479
36449
|
*/
|
|
35480
|
-
|
|
36450
|
+
textureSize : 8,
|
|
35481
36451
|
|
|
35482
36452
|
/**
|
|
35483
|
-
*
|
|
36453
|
+
* tint to be applied to particles
|
|
35484
36454
|
* @public
|
|
35485
|
-
* @type {
|
|
35486
|
-
* @name
|
|
36455
|
+
* @type {string}
|
|
36456
|
+
* @name tint
|
|
35487
36457
|
* @memberof ParticleEmitterSettings
|
|
35488
|
-
* @default
|
|
35489
|
-
* @see http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html#canvasimagesource
|
|
36458
|
+
* @default "#fff"
|
|
35490
36459
|
*/
|
|
35491
|
-
|
|
36460
|
+
tint : "#fff",
|
|
35492
36461
|
|
|
35493
36462
|
/**
|
|
35494
36463
|
* Total number of particles in the emitter
|
|
@@ -35511,7 +36480,7 @@ var ParticleEmitterSettings = {
|
|
|
35511
36480
|
angle : Math.PI / 2,
|
|
35512
36481
|
|
|
35513
36482
|
/**
|
|
35514
|
-
* Variation in the start angle for particle launch in Radians
|
|
36483
|
+
* Variation in the start angle for particle launch in Radians.
|
|
35515
36484
|
* @public
|
|
35516
36485
|
* @type {number}
|
|
35517
36486
|
* @name angleVariation
|
|
@@ -35521,7 +36490,7 @@ var ParticleEmitterSettings = {
|
|
|
35521
36490
|
angleVariation : 0,
|
|
35522
36491
|
|
|
35523
36492
|
/**
|
|
35524
|
-
* Minimum time each particle lives once it is emitted in ms
|
|
36493
|
+
* Minimum time each particle lives once it is emitted in ms.
|
|
35525
36494
|
* @public
|
|
35526
36495
|
* @type {number}
|
|
35527
36496
|
* @name minLife
|
|
@@ -35531,7 +36500,7 @@ var ParticleEmitterSettings = {
|
|
|
35531
36500
|
minLife : 1000,
|
|
35532
36501
|
|
|
35533
36502
|
/**
|
|
35534
|
-
* Maximum time each particle lives once it is emitted in ms
|
|
36503
|
+
* Maximum time each particle lives once it is emitted in ms.
|
|
35535
36504
|
* @public
|
|
35536
36505
|
* @type {number}
|
|
35537
36506
|
* @name maxLife
|
|
@@ -35654,18 +36623,31 @@ var ParticleEmitterSettings = {
|
|
|
35654
36623
|
followTrajectory : false,
|
|
35655
36624
|
|
|
35656
36625
|
/**
|
|
35657
|
-
* Enable the Texture Additive by
|
|
35658
|
-
* WARNING: Composite Operation may decreases performance!.<br>
|
|
36626
|
+
* Enable the Texture Additive by composite operation ("additive" blendMode)
|
|
35659
36627
|
* @public
|
|
35660
36628
|
* @type {boolean}
|
|
35661
36629
|
* @name textureAdditive
|
|
35662
36630
|
* @default false
|
|
35663
36631
|
* @memberof ParticleEmitterSettings
|
|
36632
|
+
* @see ParticleEmitterSettings.blendMode
|
|
35664
36633
|
*/
|
|
35665
36634
|
textureAdditive : false,
|
|
35666
36635
|
|
|
35667
36636
|
/**
|
|
35668
|
-
*
|
|
36637
|
+
* the blend mode to be applied when rendering particles.
|
|
36638
|
+
* (note: this will superseed the `textureAdditive` setting if different than "normal")
|
|
36639
|
+
* @public
|
|
36640
|
+
* @type {string}
|
|
36641
|
+
* @name blendMode
|
|
36642
|
+
* @default normal
|
|
36643
|
+
* @memberof ParticleEmitterSettings
|
|
36644
|
+
* @see CanvasRenderer#setBlendMode
|
|
36645
|
+
* @see WebGLRenderer#setBlendMode
|
|
36646
|
+
*/
|
|
36647
|
+
blendMode : "normal",
|
|
36648
|
+
|
|
36649
|
+
/**
|
|
36650
|
+
* Update particles only in the viewport, remove it when out of viewport.
|
|
35669
36651
|
* @public
|
|
35670
36652
|
* @type {boolean}
|
|
35671
36653
|
* @name onlyInViewport
|
|
@@ -35675,7 +36657,7 @@ var ParticleEmitterSettings = {
|
|
|
35675
36657
|
onlyInViewport : true,
|
|
35676
36658
|
|
|
35677
36659
|
/**
|
|
35678
|
-
* Render particles in screen space.
|
|
36660
|
+
* Render particles in screen space.
|
|
35679
36661
|
* @public
|
|
35680
36662
|
* @type {boolean}
|
|
35681
36663
|
* @name floating
|
|
@@ -35685,7 +36667,7 @@ var ParticleEmitterSettings = {
|
|
|
35685
36667
|
floating : false,
|
|
35686
36668
|
|
|
35687
36669
|
/**
|
|
35688
|
-
* Maximum number of particles launched each time in this emitter (used only if emitter is Stream)
|
|
36670
|
+
* Maximum number of particles launched each time in this emitter (used only if emitter is Stream).
|
|
35689
36671
|
* @public
|
|
35690
36672
|
* @type {number}
|
|
35691
36673
|
* @name maxParticles
|
|
@@ -35695,8 +36677,7 @@ var ParticleEmitterSettings = {
|
|
|
35695
36677
|
maxParticles : 10,
|
|
35696
36678
|
|
|
35697
36679
|
/**
|
|
35698
|
-
* How often a particle is emitted in ms (used only if emitter is Stream)
|
|
35699
|
-
* Necessary that value is greater than zero.<br>
|
|
36680
|
+
* How often a particle is emitted in ms (used only if emitter is a Stream).
|
|
35700
36681
|
* @public
|
|
35701
36682
|
* @type {number}
|
|
35702
36683
|
* @name frequency
|
|
@@ -35706,8 +36687,8 @@ var ParticleEmitterSettings = {
|
|
|
35706
36687
|
frequency : 100,
|
|
35707
36688
|
|
|
35708
36689
|
/**
|
|
35709
|
-
* Duration that the emitter releases particles in ms (used only if emitter is Stream)
|
|
35710
|
-
* After this period, the emitter stop the launch of particles
|
|
36690
|
+
* Duration that the emitter releases particles in ms (used only if emitter is Stream).
|
|
36691
|
+
* After this period, the emitter stop the launch of particles.
|
|
35711
36692
|
* @public
|
|
35712
36693
|
* @type {number}
|
|
35713
36694
|
* @name duration
|
|
@@ -35717,8 +36698,8 @@ var ParticleEmitterSettings = {
|
|
|
35717
36698
|
duration : Infinity,
|
|
35718
36699
|
|
|
35719
36700
|
/**
|
|
35720
|
-
* Skip n frames after updating the particle system once.
|
|
35721
|
-
* This can be used to reduce the performance impact of emitters with many particles
|
|
36701
|
+
* Skip n frames after updating the particle system once.
|
|
36702
|
+
* This can be used to reduce the performance impact of emitters with many particles.
|
|
35722
36703
|
* @public
|
|
35723
36704
|
* @type {number}
|
|
35724
36705
|
* @name framesToSkip
|
|
@@ -35728,44 +36709,64 @@ var ParticleEmitterSettings = {
|
|
|
35728
36709
|
framesToSkip : 0
|
|
35729
36710
|
};
|
|
35730
36711
|
|
|
36712
|
+
// default texture used when no sprite is defined
|
|
36713
|
+
let defaultParticleTexture;
|
|
36714
|
+
|
|
36715
|
+
/**
|
|
36716
|
+
* @ignore
|
|
36717
|
+
*/
|
|
36718
|
+
function createDefaultParticleTexture(w = 8, h = 8) {
|
|
36719
|
+
if (typeof defaultParticleTexture === "undefined") {
|
|
36720
|
+
defaultParticleTexture = createCanvas(w, h, true);
|
|
36721
|
+
var context = defaultParticleTexture.getContext("2d");
|
|
36722
|
+
context.fillStyle = "#fff";
|
|
36723
|
+
context.fillRect(0, 0, w, h);
|
|
36724
|
+
}
|
|
36725
|
+
return defaultParticleTexture;
|
|
36726
|
+
}
|
|
35731
36727
|
/**
|
|
36728
|
+
* @classdesc
|
|
35732
36729
|
* Particle Emitter Object.
|
|
35733
|
-
* @
|
|
35734
|
-
* @augments Rect
|
|
35735
|
-
* @param {number} x x-position of the particle emitter
|
|
35736
|
-
* @param {number} y y-position of the particle emitter
|
|
35737
|
-
* @param {object} settings An object containing the settings for the particle emitter. See {@link ParticleEmitterSettings}
|
|
35738
|
-
* @example
|
|
35739
|
-
* // Create a basic emitter at position 100, 100
|
|
35740
|
-
* var emitter = new me.ParticleEmitter(100, 100);
|
|
35741
|
-
*
|
|
35742
|
-
* // Adjust the emitter properties
|
|
35743
|
-
* emitter.totalParticles = 200;
|
|
35744
|
-
* emitter.minLife = 1000;
|
|
35745
|
-
* emitter.maxLife = 3000;
|
|
35746
|
-
* emitter.z = 10;
|
|
35747
|
-
*
|
|
35748
|
-
* // Add the emitter to the game world
|
|
35749
|
-
* me.game.world.addChild(emitter);
|
|
35750
|
-
*
|
|
35751
|
-
* // Launch all particles one time and stop, like a explosion
|
|
35752
|
-
* emitter.burstParticles();
|
|
35753
|
-
*
|
|
35754
|
-
* // Launch constantly the particles, like a fountain
|
|
35755
|
-
* emitter.streamParticles();
|
|
35756
|
-
*
|
|
35757
|
-
* // At the end, remove emitter from the game world
|
|
35758
|
-
* // call this in onDestroyEvent function
|
|
35759
|
-
* me.game.world.removeChild(emitter);
|
|
36730
|
+
* @augments Container
|
|
35760
36731
|
*/
|
|
35761
|
-
class ParticleEmitter extends
|
|
35762
|
-
|
|
36732
|
+
class ParticleEmitter extends Container {
|
|
35763
36733
|
/**
|
|
35764
|
-
* @
|
|
36734
|
+
* @param {number} x x position of the particle emitter
|
|
36735
|
+
* @param {number} y y position of the particle emitter
|
|
36736
|
+
* @param {ParticleEmitterSettings} [settings=ParticleEmitterSettings] the settings for the particle emitter.
|
|
36737
|
+
* @example
|
|
36738
|
+
* // Create a basic emitter at position 100, 100
|
|
36739
|
+
* var emitter = new ParticleEmitter(100, 100);
|
|
36740
|
+
*
|
|
36741
|
+
* // Adjust the emitter properties
|
|
36742
|
+
* emitter.totalParticles = 200;
|
|
36743
|
+
* emitter.minLife = 1000;
|
|
36744
|
+
* emitter.maxLife = 3000;
|
|
36745
|
+
* emitter.z = 10;
|
|
36746
|
+
*
|
|
36747
|
+
* // Add the emitter to the game world
|
|
36748
|
+
* me.game.world.addChild(emitter);
|
|
36749
|
+
*
|
|
36750
|
+
* // Launch all particles one time and stop, like a explosion
|
|
36751
|
+
* emitter.burstParticles();
|
|
36752
|
+
*
|
|
36753
|
+
* // Launch constantly the particles, like a fountain
|
|
36754
|
+
* emitter.streamParticles();
|
|
36755
|
+
*
|
|
36756
|
+
* // At the end, remove emitter from the game world
|
|
36757
|
+
* // call this in onDestroyEvent function
|
|
36758
|
+
* me.game.world.removeChild(emitter);
|
|
35765
36759
|
*/
|
|
35766
|
-
constructor(x, y, settings) {
|
|
36760
|
+
constructor(x, y, settings = {}) {
|
|
35767
36761
|
// call the super constructor
|
|
35768
|
-
super(
|
|
36762
|
+
super(
|
|
36763
|
+
x, y,
|
|
36764
|
+
settings.width | 1,
|
|
36765
|
+
settings.height | 1
|
|
36766
|
+
);
|
|
36767
|
+
|
|
36768
|
+
// center the emitter around the given coordinates
|
|
36769
|
+
this.centerOn(x, y);
|
|
35769
36770
|
|
|
35770
36771
|
// Emitter is Stream, launch particles constantly
|
|
35771
36772
|
/** @ignore */
|
|
@@ -35791,109 +36792,52 @@ class ParticleEmitter extends Renderable {
|
|
|
35791
36792
|
// don't sort the particles by z-index
|
|
35792
36793
|
this.autoSort = false;
|
|
35793
36794
|
|
|
35794
|
-
|
|
35795
|
-
|
|
35796
|
-
// Reset the emitter to defaults
|
|
35797
|
-
this.reset(settings);
|
|
35798
|
-
}
|
|
36795
|
+
// count the updates
|
|
36796
|
+
this._updateCount = 0;
|
|
35799
36797
|
|
|
35800
|
-
|
|
35801
|
-
|
|
35802
|
-
*/
|
|
35803
|
-
get z() {
|
|
35804
|
-
return this.container.pos.z;
|
|
35805
|
-
}
|
|
36798
|
+
// the emitter settings
|
|
36799
|
+
this.settings = {};
|
|
35806
36800
|
|
|
35807
|
-
|
|
35808
|
-
|
|
35809
|
-
*/
|
|
35810
|
-
set z(value) {
|
|
35811
|
-
this.container.pos.z = value;
|
|
35812
|
-
}
|
|
36801
|
+
// internally store how much time was skipped when frames are skipped
|
|
36802
|
+
this._dt = 0;
|
|
35813
36803
|
|
|
35814
|
-
|
|
35815
|
-
* Floating property for particles, value is forwarded to the particle container <br>
|
|
35816
|
-
* @type {boolean}
|
|
35817
|
-
* @name floating
|
|
35818
|
-
* @memberof ParticleEmitter
|
|
35819
|
-
*/
|
|
35820
|
-
get floating() {
|
|
35821
|
-
return this.container.floating;
|
|
35822
|
-
}
|
|
36804
|
+
//this.anchorPoint.set(0, 0);
|
|
35823
36805
|
|
|
35824
|
-
|
|
35825
|
-
this.
|
|
36806
|
+
// Reset the emitter to defaults
|
|
36807
|
+
this.reset(settings);
|
|
35826
36808
|
}
|
|
35827
36809
|
|
|
35828
36810
|
/**
|
|
35829
|
-
*
|
|
36811
|
+
* Reset the emitter with particle emitter settings.
|
|
36812
|
+
* @param {object} settings [optional] object with emitter settings. See {@link ParticleEmitterSettings}
|
|
35830
36813
|
*/
|
|
35831
|
-
|
|
35832
|
-
|
|
35833
|
-
this.container.pos.z = this.pos.z;
|
|
35834
|
-
if (!this.ancestor.autoSort) {
|
|
35835
|
-
this.ancestor.sort();
|
|
35836
|
-
}
|
|
35837
|
-
}
|
|
36814
|
+
reset(settings = {}) {
|
|
36815
|
+
Object.assign(this.settings, ParticleEmitterSettings, settings);
|
|
35838
36816
|
|
|
35839
|
-
|
|
35840
|
-
|
|
35841
|
-
|
|
35842
|
-
onDeactivateEvent() {
|
|
35843
|
-
if (this.ancestor.hasChild(this.container)) {
|
|
35844
|
-
this.ancestor.removeChildNow(this.container);
|
|
36817
|
+
// Cache the image reference
|
|
36818
|
+
if (typeof this.settings.image === "undefined") {
|
|
36819
|
+
this.settings.image = createDefaultParticleTexture(settings.textureSize, settings.textureSize);
|
|
35845
36820
|
}
|
|
35846
|
-
}
|
|
35847
36821
|
|
|
35848
|
-
|
|
35849
|
-
|
|
35850
|
-
|
|
35851
|
-
destroy() {
|
|
35852
|
-
this.reset();
|
|
36822
|
+
this.floating = this.settings.floating;
|
|
36823
|
+
|
|
36824
|
+
this.isDirty = true;
|
|
35853
36825
|
}
|
|
35854
36826
|
|
|
35855
36827
|
/**
|
|
35856
|
-
* returns a random point
|
|
35857
|
-
* @name getRandomPointX
|
|
35858
|
-
* @memberof ParticleEmitter
|
|
35859
|
-
* @function
|
|
36828
|
+
* returns a random point on the x axis within the bounds of this emitter
|
|
35860
36829
|
* @returns {number}
|
|
35861
36830
|
*/
|
|
35862
36831
|
getRandomPointX() {
|
|
35863
|
-
return
|
|
36832
|
+
return randomFloat(0, this.getBounds().width);
|
|
35864
36833
|
}
|
|
35865
36834
|
|
|
35866
36835
|
/**
|
|
35867
|
-
* returns a random point
|
|
35868
|
-
* @name getRandomPointY
|
|
35869
|
-
* @memberof ParticleEmitter
|
|
35870
|
-
* @function
|
|
36836
|
+
* returns a random point on the y axis within the bounds this emitter
|
|
35871
36837
|
* @returns {number}
|
|
35872
36838
|
*/
|
|
35873
36839
|
getRandomPointY() {
|
|
35874
|
-
return
|
|
35875
|
-
}
|
|
35876
|
-
|
|
35877
|
-
/**
|
|
35878
|
-
* Reset the emitter with default values.<br>
|
|
35879
|
-
* @function
|
|
35880
|
-
* @param {object} settings [optional] object with emitter settings. See {@link ParticleEmitterSettings}
|
|
35881
|
-
* @name reset
|
|
35882
|
-
* @memberof ParticleEmitter
|
|
35883
|
-
*/
|
|
35884
|
-
reset(settings) {
|
|
35885
|
-
// check if settings exists and create a dummy object if necessary
|
|
35886
|
-
settings = settings || {};
|
|
35887
|
-
var defaults = ParticleEmitterSettings;
|
|
35888
|
-
|
|
35889
|
-
var width = (typeof settings.width === "number") ? settings.width : defaults.width;
|
|
35890
|
-
var height = (typeof settings.height === "number") ? settings.height : defaults.height;
|
|
35891
|
-
this.resize(width, height);
|
|
35892
|
-
|
|
35893
|
-
Object.assign(this, defaults, settings);
|
|
35894
|
-
|
|
35895
|
-
// reset particle container values
|
|
35896
|
-
this.container.reset();
|
|
36840
|
+
return randomFloat(0, this.getBounds().height);
|
|
35897
36841
|
}
|
|
35898
36842
|
|
|
35899
36843
|
// Add count particles in the game world
|
|
@@ -35901,59 +36845,45 @@ class ParticleEmitter extends Renderable {
|
|
|
35901
36845
|
addParticles(count) {
|
|
35902
36846
|
for (var i = 0; i < ~~count; i++) {
|
|
35903
36847
|
// Add particle to the container
|
|
35904
|
-
|
|
35905
|
-
this.container.addChild(particle);
|
|
36848
|
+
this.addChild(pull("Particle", this), this.pos.z);
|
|
35906
36849
|
}
|
|
36850
|
+
this.isDirty = true;
|
|
35907
36851
|
}
|
|
35908
36852
|
|
|
35909
36853
|
/**
|
|
35910
|
-
* Emitter is of type stream and is launching particles
|
|
35911
|
-
* @function
|
|
36854
|
+
* Emitter is of type stream and is launching particles
|
|
35912
36855
|
* @returns {boolean} Emitter is Stream and is launching particles
|
|
35913
|
-
* @name isRunning
|
|
35914
|
-
* @memberof ParticleEmitter
|
|
35915
36856
|
*/
|
|
35916
36857
|
isRunning() {
|
|
35917
36858
|
return this._enabled && this._stream;
|
|
35918
36859
|
}
|
|
35919
36860
|
|
|
35920
36861
|
/**
|
|
35921
|
-
* Launch particles from emitter constantly
|
|
35922
|
-
* Particles example: Fountains
|
|
36862
|
+
* Launch particles from emitter constantly (e.g. for stream)
|
|
35923
36863
|
* @param {number} duration [optional] time that the emitter releases particles in ms
|
|
35924
|
-
* @function
|
|
35925
|
-
* @name streamParticles
|
|
35926
|
-
* @memberof ParticleEmitter
|
|
35927
36864
|
*/
|
|
35928
36865
|
streamParticles(duration) {
|
|
35929
36866
|
this._enabled = true;
|
|
35930
36867
|
this._stream = true;
|
|
35931
|
-
this.frequency = Math.max(this.frequency
|
|
35932
|
-
this._durationTimer = (typeof duration === "number") ? duration : this.duration;
|
|
36868
|
+
this.settings.frequency = Math.max(1, this.settings.frequency);
|
|
36869
|
+
this._durationTimer = (typeof duration === "number") ? duration : this.settings.duration;
|
|
35933
36870
|
}
|
|
35934
36871
|
|
|
35935
36872
|
/**
|
|
35936
|
-
* Stop the emitter from generating new particles (used only if emitter is Stream)
|
|
35937
|
-
* @function
|
|
35938
|
-
* @name stopStream
|
|
35939
|
-
* @memberof ParticleEmitter
|
|
36873
|
+
* Stop the emitter from generating new particles (used only if emitter is Stream)
|
|
35940
36874
|
*/
|
|
35941
36875
|
stopStream() {
|
|
35942
36876
|
this._enabled = false;
|
|
35943
36877
|
}
|
|
35944
36878
|
|
|
35945
36879
|
/**
|
|
35946
|
-
* Launch all particles from emitter and stop
|
|
35947
|
-
* Particles example: Explosions <br>
|
|
36880
|
+
* Launch all particles from emitter and stop (e.g. for explosion)
|
|
35948
36881
|
* @param {number} total [optional] number of particles to launch
|
|
35949
|
-
* @function
|
|
35950
|
-
* @name burstParticles
|
|
35951
|
-
* @memberof ParticleEmitter
|
|
35952
36882
|
*/
|
|
35953
36883
|
burstParticles(total) {
|
|
35954
36884
|
this._enabled = true;
|
|
35955
36885
|
this._stream = false;
|
|
35956
|
-
this.addParticles((typeof total === "number") ? total : this.totalParticles);
|
|
36886
|
+
this.addParticles((typeof total === "number") ? total : this.settings.totalParticles);
|
|
35957
36887
|
this._enabled = false;
|
|
35958
36888
|
}
|
|
35959
36889
|
|
|
@@ -35961,6 +36891,22 @@ class ParticleEmitter extends Renderable {
|
|
|
35961
36891
|
* @ignore
|
|
35962
36892
|
*/
|
|
35963
36893
|
update(dt) {
|
|
36894
|
+
// skip frames if necessary
|
|
36895
|
+
if (++this._updateCount > this.settings.framesToSkip) {
|
|
36896
|
+
this._updateCount = 0;
|
|
36897
|
+
}
|
|
36898
|
+
if (this._updateCount > 0) {
|
|
36899
|
+
this._dt += dt;
|
|
36900
|
+
return this.isDirty;
|
|
36901
|
+
}
|
|
36902
|
+
|
|
36903
|
+
// apply skipped delta time
|
|
36904
|
+
dt += this._dt;
|
|
36905
|
+
this._dt = 0;
|
|
36906
|
+
|
|
36907
|
+
// Update particles
|
|
36908
|
+
this.isDirty |= super.update(dt);
|
|
36909
|
+
|
|
35964
36910
|
// Launch new particles, if emitter is Stream
|
|
35965
36911
|
if ((this._enabled) && (this._stream)) {
|
|
35966
36912
|
// Check if the emitter has duration set
|
|
@@ -35969,7 +36915,7 @@ class ParticleEmitter extends Renderable {
|
|
|
35969
36915
|
|
|
35970
36916
|
if (this._durationTimer <= 0) {
|
|
35971
36917
|
this.stopStream();
|
|
35972
|
-
return
|
|
36918
|
+
return this.isDirty;
|
|
35973
36919
|
}
|
|
35974
36920
|
}
|
|
35975
36921
|
|
|
@@ -35977,117 +36923,136 @@ class ParticleEmitter extends Renderable {
|
|
|
35977
36923
|
this._frequencyTimer += dt;
|
|
35978
36924
|
|
|
35979
36925
|
// Check for new particles launch
|
|
35980
|
-
var particlesCount = this.
|
|
35981
|
-
if ((particlesCount < this.totalParticles) && (this._frequencyTimer >= this.frequency)) {
|
|
35982
|
-
if ((particlesCount + this.maxParticles) <= this.totalParticles) {
|
|
35983
|
-
this.addParticles(this.maxParticles);
|
|
36926
|
+
var particlesCount = this.children.length;
|
|
36927
|
+
if ((particlesCount < this.settings.totalParticles) && (this._frequencyTimer >= this.settings.frequency)) {
|
|
36928
|
+
if ((particlesCount + this.settings.maxParticles) <= this.settings.totalParticles) {
|
|
36929
|
+
this.addParticles(this.settings.maxParticles);
|
|
35984
36930
|
}
|
|
35985
36931
|
else {
|
|
35986
|
-
this.addParticles(this.totalParticles - particlesCount);
|
|
36932
|
+
this.addParticles(this.settings.totalParticles - particlesCount);
|
|
35987
36933
|
}
|
|
35988
|
-
|
|
35989
36934
|
this._frequencyTimer = 0;
|
|
36935
|
+
this.isDirty = true;
|
|
35990
36936
|
}
|
|
35991
36937
|
}
|
|
35992
|
-
return
|
|
36938
|
+
return this.isDirty;
|
|
35993
36939
|
}
|
|
35994
36940
|
|
|
36941
|
+
/**
|
|
36942
|
+
* Destroy function
|
|
36943
|
+
* @ignore
|
|
36944
|
+
*/
|
|
36945
|
+
destroy() {
|
|
36946
|
+
// call the parent destroy method
|
|
36947
|
+
super.destroy(arguments);
|
|
36948
|
+
// clean emitter specific Properties
|
|
36949
|
+
this.settings.image = undefined;
|
|
36950
|
+
this.settings = undefined;
|
|
36951
|
+
}
|
|
35995
36952
|
}
|
|
35996
36953
|
|
|
35997
36954
|
/**
|
|
35998
36955
|
* @classdesc
|
|
35999
36956
|
* Single Particle Object.
|
|
36000
|
-
* @class Particle
|
|
36001
36957
|
* @augments Renderable
|
|
36002
|
-
* @param {ParticleEmitter} particle emitter
|
|
36003
36958
|
*/
|
|
36004
36959
|
class Particle extends Renderable {
|
|
36005
36960
|
/**
|
|
36006
|
-
* @
|
|
36961
|
+
* @param {ParticleEmitter} emitter the particle emitter
|
|
36007
36962
|
*/
|
|
36008
36963
|
constructor(emitter) {
|
|
36009
36964
|
// Call the super constructor
|
|
36010
36965
|
super(
|
|
36011
36966
|
emitter.getRandomPointX(),
|
|
36012
36967
|
emitter.getRandomPointY(),
|
|
36013
|
-
emitter.image.width,
|
|
36014
|
-
emitter.image.height
|
|
36968
|
+
emitter.settings.image.width,
|
|
36969
|
+
emitter.settings.image.height
|
|
36015
36970
|
);
|
|
36016
|
-
|
|
36017
|
-
// particle velocity
|
|
36018
|
-
this.vel = new Vector2d();
|
|
36019
36971
|
this.onResetEvent(emitter, true);
|
|
36020
36972
|
}
|
|
36021
36973
|
|
|
36974
|
+
/**
|
|
36975
|
+
* @ignore
|
|
36976
|
+
*/
|
|
36022
36977
|
onResetEvent(emitter, newInstance = false) {
|
|
36023
36978
|
if (newInstance === false) {
|
|
36024
|
-
|
|
36979
|
+
this.pos.set(
|
|
36025
36980
|
emitter.getRandomPointX(),
|
|
36026
|
-
emitter.getRandomPointY()
|
|
36027
|
-
|
|
36028
|
-
|
|
36981
|
+
emitter.getRandomPointY()
|
|
36982
|
+
);
|
|
36983
|
+
this.resize(
|
|
36984
|
+
emitter.settings.image.width,
|
|
36985
|
+
emitter.settings.image.height
|
|
36029
36986
|
);
|
|
36987
|
+
} else {
|
|
36988
|
+
// particle velocity
|
|
36989
|
+
this.vel = new Vector2d();
|
|
36030
36990
|
}
|
|
36031
36991
|
|
|
36992
|
+
this.image = emitter.settings.image;
|
|
36993
|
+
|
|
36032
36994
|
// Particle will always update
|
|
36033
36995
|
this.alwaysUpdate = true;
|
|
36034
36996
|
|
|
36035
|
-
|
|
36036
|
-
|
|
36997
|
+
if (typeof emitter.settings.tint === "string") {
|
|
36998
|
+
this.tint.parseCSS(emitter.settings.tint);
|
|
36999
|
+
}
|
|
37000
|
+
|
|
37001
|
+
if (emitter.settings.textureAdditive === true) {
|
|
37002
|
+
this.blendMode = "additive";
|
|
37003
|
+
}
|
|
37004
|
+
|
|
37005
|
+
if (emitter.settings.blendMode !== "normal") {
|
|
37006
|
+
this.blendMode = emitter.settings.blendMode;
|
|
37007
|
+
}
|
|
36037
37008
|
|
|
36038
37009
|
// Set the start particle Angle and Speed as defined in emitter
|
|
36039
|
-
var angle = emitter.angle + ((emitter.angleVariation > 0) ? (randomFloat(0, 2) - 1) * emitter.angleVariation : 0);
|
|
36040
|
-
var speed = emitter.speed + ((emitter.speedVariation > 0) ? (randomFloat(0, 2) - 1) * emitter.speedVariation : 0);
|
|
37010
|
+
var angle = emitter.settings.angle + ((emitter.settings.angleVariation > 0) ? (randomFloat(0, 2) - 1) * emitter.settings.angleVariation : 0);
|
|
37011
|
+
var speed = emitter.settings.speed + ((emitter.settings.speedVariation > 0) ? (randomFloat(0, 2) - 1) * emitter.settings.speedVariation : 0);
|
|
36041
37012
|
|
|
36042
37013
|
// Set the start particle Velocity
|
|
36043
37014
|
this.vel.set(speed * Math.cos(angle), -speed * Math.sin(angle));
|
|
36044
37015
|
|
|
36045
37016
|
// Set the start particle Time of Life as defined in emitter
|
|
36046
|
-
this.life = randomFloat(emitter.minLife, emitter.maxLife);
|
|
37017
|
+
this.life = randomFloat(emitter.settings.minLife, emitter.settings.maxLife);
|
|
36047
37018
|
this.startLife = this.life;
|
|
36048
37019
|
|
|
36049
37020
|
// Set the start and end particle Scale as defined in emitter
|
|
36050
37021
|
// clamp the values as minimum and maximum scales range
|
|
36051
37022
|
this.startScale = clamp(
|
|
36052
|
-
randomFloat(emitter.minStartScale, emitter.maxStartScale),
|
|
36053
|
-
emitter.minStartScale,
|
|
36054
|
-
emitter.maxStartScale
|
|
37023
|
+
randomFloat(emitter.settings.minStartScale, emitter.settings.maxStartScale),
|
|
37024
|
+
emitter.settings.minStartScale,
|
|
37025
|
+
emitter.settings.maxStartScale
|
|
36055
37026
|
);
|
|
36056
37027
|
this.endScale = clamp(
|
|
36057
|
-
randomFloat(emitter.minEndScale, emitter.maxEndScale),
|
|
36058
|
-
emitter.minEndScale,
|
|
36059
|
-
emitter.maxEndScale
|
|
37028
|
+
randomFloat(emitter.settings.minEndScale, emitter.settings.maxEndScale),
|
|
37029
|
+
emitter.settings.minEndScale,
|
|
37030
|
+
emitter.settings.maxEndScale
|
|
36060
37031
|
);
|
|
36061
37032
|
|
|
36062
37033
|
// Set the particle Gravity and Wind (horizontal gravity) as defined in emitter
|
|
36063
|
-
this.gravity = emitter.gravity;
|
|
36064
|
-
this.wind = emitter.wind;
|
|
37034
|
+
this.gravity = emitter.settings.gravity;
|
|
37035
|
+
this.wind = emitter.settings.wind;
|
|
36065
37036
|
|
|
36066
37037
|
// Set if the particle update the rotation in accordance the trajectory
|
|
36067
|
-
this.followTrajectory = emitter.followTrajectory;
|
|
37038
|
+
this.followTrajectory = emitter.settings.followTrajectory;
|
|
36068
37039
|
|
|
36069
37040
|
// Set if the particle update only in Viewport
|
|
36070
|
-
this.onlyInViewport = emitter.onlyInViewport;
|
|
36071
|
-
|
|
36072
|
-
// Set the particle Z Order
|
|
36073
|
-
this.pos.z = emitter.z;
|
|
37041
|
+
this.onlyInViewport = emitter.settings.onlyInViewport;
|
|
36074
37042
|
|
|
36075
37043
|
// cache inverse of the expected delta time
|
|
36076
37044
|
this._deltaInv = timer$1.maxfps / 1000;
|
|
36077
37045
|
|
|
36078
37046
|
// Set the start particle rotation as defined in emitter
|
|
36079
37047
|
// if the particle not follow trajectory
|
|
36080
|
-
if (!emitter.followTrajectory) {
|
|
36081
|
-
this.angle = randomFloat(emitter.minRotation, emitter.maxRotation);
|
|
37048
|
+
if (!emitter.settings.followTrajectory) {
|
|
37049
|
+
this.angle = randomFloat(emitter.settings.minRotation, emitter.settings.maxRotation);
|
|
36082
37050
|
}
|
|
36083
37051
|
}
|
|
36084
37052
|
|
|
36085
37053
|
/**
|
|
36086
37054
|
* Update the Particle <br>
|
|
36087
37055
|
* This is automatically called by the game manager {@link game}
|
|
36088
|
-
* @name update
|
|
36089
|
-
* @memberof Particle
|
|
36090
|
-
* @function
|
|
36091
37056
|
* @ignore
|
|
36092
37057
|
* @param {number} dt time since the last update in milliseconds
|
|
36093
37058
|
*/
|
|
@@ -36098,6 +37063,11 @@ class Particle extends Renderable {
|
|
|
36098
37063
|
// Decrease particle life
|
|
36099
37064
|
this.life = this.life > dt ? this.life - dt : 0;
|
|
36100
37065
|
|
|
37066
|
+
if (this.life <= 0) {
|
|
37067
|
+
this.ancestor.removeChild(this);
|
|
37068
|
+
return false;
|
|
37069
|
+
}
|
|
37070
|
+
|
|
36101
37071
|
// Calculate the particle Age Ratio
|
|
36102
37072
|
var ageRatio = this.life / this.startLife;
|
|
36103
37073
|
|
|
@@ -36132,23 +37102,10 @@ class Particle extends Renderable {
|
|
|
36132
37102
|
this.pos.x, this.pos.y, 1
|
|
36133
37103
|
).rotate(angle);
|
|
36134
37104
|
|
|
36135
|
-
//
|
|
36136
|
-
|
|
36137
|
-
}
|
|
36138
|
-
|
|
36139
|
-
/**
|
|
36140
|
-
* @ignore
|
|
36141
|
-
*/
|
|
36142
|
-
preDraw(renderer) {
|
|
37105
|
+
// mark as dirty if the particle is not dead yet
|
|
37106
|
+
this.isDirty = this.inViewport || !this.onlyInViewport;
|
|
36143
37107
|
|
|
36144
|
-
|
|
36145
|
-
renderer.save();
|
|
36146
|
-
|
|
36147
|
-
// particle alpha value
|
|
36148
|
-
renderer.setGlobalAlpha(renderer.globalAlpha() * this.alpha);
|
|
36149
|
-
|
|
36150
|
-
// translate to the defined anchor point and scale it
|
|
36151
|
-
renderer.transform(this.currentTransform);
|
|
37108
|
+
return super.update(dt);
|
|
36152
37109
|
}
|
|
36153
37110
|
|
|
36154
37111
|
/**
|
|
@@ -36527,7 +37484,7 @@ class DroptargetEntity extends DropTarget {
|
|
|
36527
37484
|
}
|
|
36528
37485
|
}
|
|
36529
37486
|
|
|
36530
|
-
// ES5 polyfills
|
|
37487
|
+
// ES5/ES6 polyfills
|
|
36531
37488
|
|
|
36532
37489
|
|
|
36533
37490
|
/**
|
|
@@ -36537,7 +37494,7 @@ class DroptargetEntity extends DropTarget {
|
|
|
36537
37494
|
* @name version
|
|
36538
37495
|
* @type {string}
|
|
36539
37496
|
*/
|
|
36540
|
-
const version = "10.
|
|
37497
|
+
const version = "10.7.1";
|
|
36541
37498
|
|
|
36542
37499
|
|
|
36543
37500
|
/**
|
|
@@ -36644,4 +37601,4 @@ device$1.onReady(function () {
|
|
|
36644
37601
|
}
|
|
36645
37602
|
});
|
|
36646
37603
|
|
|
36647
|
-
export { BitmapText, BitmapTextData, Body, Bounds$1 as Bounds, Camera2d, CanvasRenderer, Collectable, Color, ColorLayer, Container, Draggable, DraggableEntity, DropTarget, DroptargetEntity, Ellipse, Entity, GLShader, GUI_Object, ImageLayer, Line, math as Math, Matrix2d, Matrix3d, NineSliceSprite, ObservableVector2d, ObservableVector3d, Particle, ParticleEmitter, ParticleEmitterSettings, Pointer, Polygon, QuadTree, Rect, Renderable, Renderer, Sprite, Stage, TMXHexagonalRenderer, TMXIsometricRenderer, TMXLayer, TMXOrthogonalRenderer, TMXRenderer, TMXStaggeredRenderer, TMXTileMap, TMXTileset, TMXTilesetGroup, Text, TextureAtlas, Tile, Trigger, Tween, Vector2d, Vector3d, WebGLCompositor, WebGLRenderer, World, audio, boot, collision, device$1 as device, event, game, initialized, input, level, loader, plugin, plugins, pooling as pool, save, skipAutoInit, state, timer$1 as timer, utils, version, video, warning };
|
|
37604
|
+
export { BitmapText, BitmapTextData, Body, Bounds$1 as Bounds, Camera2d, CanvasRenderer, Collectable, Color, ColorLayer, Container, Draggable, DraggableEntity, DropTarget, DroptargetEntity, Ellipse, Entity, GLShader, GUI_Object, ImageLayer, Line, math as Math, Matrix2d, Matrix3d, NineSliceSprite, ObservableVector2d, ObservableVector3d, Particle, ParticleEmitter, ParticleEmitterSettings, Pointer, Polygon, QuadTree, Rect, Renderable, Renderer, Sprite, Stage, TMXHexagonalRenderer, TMXIsometricRenderer, TMXLayer, TMXOrthogonalRenderer, TMXRenderer, TMXStaggeredRenderer, TMXTileMap, TMXTileset, TMXTilesetGroup, Text, TextureAtlas, Tile, Trigger, Tween, Vector2d, Vector3d, WebGLCompositor, WebGLRenderer, World, audio, boot, collision, device$1 as device, event$1 as event, game, initialized, input, level, loader, plugin, plugins, pooling as pool, save, skipAutoInit, state, timer$1 as timer, utils, version, video, warning };
|