melonjs 10.9.0 → 10.10.0
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/LICENSE.md +1 -1
- package/README.md +29 -23
- package/dist/melonjs.js +812 -485
- package/dist/melonjs.min.js +4 -4
- package/dist/melonjs.module.d.ts +413 -230
- package/dist/melonjs.module.js +751 -437
- package/package.json +13 -10
- package/src/game.js +2 -2
- package/src/geometries/ellipse.js +16 -16
- package/src/geometries/line.js +4 -4
- package/src/geometries/path2d.js +10 -10
- package/src/geometries/poly.js +23 -23
- package/src/geometries/rectangle.js +22 -22
- package/src/geometries/roundrect.js +6 -6
- package/src/index.js +7 -1
- package/src/lang/deprecated.js +7 -5
- package/src/level/tiled/TMXUtils.js +1 -1
- package/src/loader/loadingscreen.js +16 -5
- package/src/math/color.js +5 -4
- package/src/particles/emitter.js +11 -12
- package/src/renderable/GUI.js +5 -5
- package/src/renderable/container.js +26 -26
- package/src/renderable/imagelayer.js +2 -2
- package/src/renderable/light2d.js +115 -0
- package/src/renderable/renderable.js +21 -20
- package/src/renderable/sprite.js +13 -13
- package/src/state/stage.js +72 -2
- package/src/text/text.js +13 -17
- package/src/video/canvas/canvas_renderer.js +69 -51
- package/src/video/renderer.js +33 -26
- package/src/video/{texture.js → texture/atlas.js} +8 -8
- package/src/video/{texture_cache.js → texture/cache.js} +4 -4
- package/src/video/texture/canvas_texture.js +87 -0
- package/src/video/webgl/webgl_renderer.js +73 -55
package/dist/melonjs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* melonJS Game Engine - v10.
|
|
2
|
+
* melonJS Game Engine - v10.10.0
|
|
3
3
|
* http://www.melonjs.org
|
|
4
4
|
* melonjs is licensed under the MIT License.
|
|
5
5
|
* http://www.opensource.org/licenses/mit-license
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
};
|
|
19
19
|
|
|
20
20
|
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
|
|
21
|
-
var global$
|
|
21
|
+
var global$b =
|
|
22
22
|
// eslint-disable-next-line es-x/no-global-this -- safe
|
|
23
23
|
check(typeof globalThis == 'object' && globalThis) ||
|
|
24
24
|
check(typeof window == 'object' && window) ||
|
|
@@ -112,31 +112,28 @@
|
|
|
112
112
|
return stringSlice(toString$2(it), 8, -1);
|
|
113
113
|
};
|
|
114
114
|
|
|
115
|
-
var global$l = global$m;
|
|
116
115
|
var uncurryThis$7 = functionUncurryThis;
|
|
117
116
|
var fails$5 = fails$8;
|
|
118
117
|
var classof = classofRaw;
|
|
119
118
|
|
|
120
|
-
var Object$
|
|
119
|
+
var $Object$2 = Object;
|
|
121
120
|
var split = uncurryThis$7(''.split);
|
|
122
121
|
|
|
123
122
|
// fallback for non-array-like ES3 and non-enumerable old V8 strings
|
|
124
123
|
var indexedObject = fails$5(function () {
|
|
125
124
|
// throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
|
|
126
125
|
// eslint-disable-next-line no-prototype-builtins -- safe
|
|
127
|
-
return
|
|
126
|
+
return !$Object$2('z').propertyIsEnumerable(0);
|
|
128
127
|
}) ? function (it) {
|
|
129
|
-
return classof(it) == 'String' ? split(it, '') : Object$
|
|
130
|
-
} : Object$
|
|
128
|
+
return classof(it) == 'String' ? split(it, '') : $Object$2(it);
|
|
129
|
+
} : $Object$2;
|
|
131
130
|
|
|
132
|
-
var
|
|
133
|
-
|
|
134
|
-
var TypeError$7 = global$k.TypeError;
|
|
131
|
+
var $TypeError$5 = TypeError;
|
|
135
132
|
|
|
136
133
|
// `RequireObjectCoercible` abstract operation
|
|
137
134
|
// https://tc39.es/ecma262/#sec-requireobjectcoercible
|
|
138
135
|
var requireObjectCoercible$2 = function (it) {
|
|
139
|
-
if (it == undefined) { throw TypeError$
|
|
136
|
+
if (it == undefined) { throw $TypeError$5("Can't call method on " + it); }
|
|
140
137
|
return it;
|
|
141
138
|
};
|
|
142
139
|
|
|
@@ -160,7 +157,7 @@
|
|
|
160
157
|
return typeof it == 'object' ? it !== null : isCallable$9(it);
|
|
161
158
|
};
|
|
162
159
|
|
|
163
|
-
var global$
|
|
160
|
+
var global$a = global$b;
|
|
164
161
|
var isCallable$8 = isCallable$a;
|
|
165
162
|
|
|
166
163
|
var aFunction = function (argument) {
|
|
@@ -168,7 +165,7 @@
|
|
|
168
165
|
};
|
|
169
166
|
|
|
170
167
|
var getBuiltIn$3 = function (namespace, method) {
|
|
171
|
-
return arguments.length < 2 ? aFunction(global$
|
|
168
|
+
return arguments.length < 2 ? aFunction(global$a[namespace]) : global$a[namespace] && global$a[namespace][method];
|
|
172
169
|
};
|
|
173
170
|
|
|
174
171
|
var uncurryThis$6 = functionUncurryThis;
|
|
@@ -179,11 +176,11 @@
|
|
|
179
176
|
|
|
180
177
|
var engineUserAgent = getBuiltIn$2('navigator', 'userAgent') || '';
|
|
181
178
|
|
|
182
|
-
var global$
|
|
179
|
+
var global$9 = global$b;
|
|
183
180
|
var userAgent = engineUserAgent;
|
|
184
181
|
|
|
185
|
-
var process$1 = global$
|
|
186
|
-
var Deno = global$
|
|
182
|
+
var process$1 = global$9.process;
|
|
183
|
+
var Deno = global$9.Deno;
|
|
187
184
|
var versions = process$1 && process$1.versions || Deno && Deno.version;
|
|
188
185
|
var v8 = versions && versions.v8;
|
|
189
186
|
var match, version$1;
|
|
@@ -230,43 +227,39 @@
|
|
|
230
227
|
&& !Symbol.sham
|
|
231
228
|
&& typeof Symbol.iterator == 'symbol';
|
|
232
229
|
|
|
233
|
-
var global$h = global$m;
|
|
234
230
|
var getBuiltIn$1 = getBuiltIn$3;
|
|
235
231
|
var isCallable$7 = isCallable$a;
|
|
236
232
|
var isPrototypeOf = objectIsPrototypeOf;
|
|
237
233
|
var USE_SYMBOL_AS_UID$1 = useSymbolAsUid;
|
|
238
234
|
|
|
239
|
-
var Object$
|
|
235
|
+
var $Object$1 = Object;
|
|
240
236
|
|
|
241
237
|
var isSymbol$2 = USE_SYMBOL_AS_UID$1 ? function (it) {
|
|
242
238
|
return typeof it == 'symbol';
|
|
243
239
|
} : function (it) {
|
|
244
240
|
var $Symbol = getBuiltIn$1('Symbol');
|
|
245
|
-
return isCallable$7($Symbol) && isPrototypeOf($Symbol.prototype, Object$
|
|
241
|
+
return isCallable$7($Symbol) && isPrototypeOf($Symbol.prototype, $Object$1(it));
|
|
246
242
|
};
|
|
247
243
|
|
|
248
|
-
var
|
|
249
|
-
|
|
250
|
-
var String$2 = global$g.String;
|
|
244
|
+
var $String$1 = String;
|
|
251
245
|
|
|
252
246
|
var tryToString$1 = function (argument) {
|
|
253
247
|
try {
|
|
254
|
-
return String$
|
|
248
|
+
return $String$1(argument);
|
|
255
249
|
} catch (error) {
|
|
256
250
|
return 'Object';
|
|
257
251
|
}
|
|
258
252
|
};
|
|
259
253
|
|
|
260
|
-
var global$f = global$m;
|
|
261
254
|
var isCallable$6 = isCallable$a;
|
|
262
255
|
var tryToString = tryToString$1;
|
|
263
256
|
|
|
264
|
-
var TypeError$
|
|
257
|
+
var $TypeError$4 = TypeError;
|
|
265
258
|
|
|
266
259
|
// `Assert: IsCallable(argument) is true`
|
|
267
260
|
var aCallable$1 = function (argument) {
|
|
268
261
|
if (isCallable$6(argument)) { return argument; }
|
|
269
|
-
throw TypeError$
|
|
262
|
+
throw $TypeError$4(tryToString(argument) + ' is not a function');
|
|
270
263
|
};
|
|
271
264
|
|
|
272
265
|
var aCallable = aCallable$1;
|
|
@@ -278,12 +271,11 @@
|
|
|
278
271
|
return func == null ? undefined : aCallable(func);
|
|
279
272
|
};
|
|
280
273
|
|
|
281
|
-
var global$e = global$m;
|
|
282
274
|
var call$2 = functionCall;
|
|
283
275
|
var isCallable$5 = isCallable$a;
|
|
284
276
|
var isObject$4 = isObject$5;
|
|
285
277
|
|
|
286
|
-
var TypeError$
|
|
278
|
+
var $TypeError$3 = TypeError;
|
|
287
279
|
|
|
288
280
|
// `OrdinaryToPrimitive` abstract operation
|
|
289
281
|
// https://tc39.es/ecma262/#sec-ordinarytoprimitive
|
|
@@ -292,29 +284,29 @@
|
|
|
292
284
|
if (pref === 'string' && isCallable$5(fn = input.toString) && !isObject$4(val = call$2(fn, input))) { return val; }
|
|
293
285
|
if (isCallable$5(fn = input.valueOf) && !isObject$4(val = call$2(fn, input))) { return val; }
|
|
294
286
|
if (pref !== 'string' && isCallable$5(fn = input.toString) && !isObject$4(val = call$2(fn, input))) { return val; }
|
|
295
|
-
throw TypeError$
|
|
287
|
+
throw $TypeError$3("Can't convert object to primitive value");
|
|
296
288
|
};
|
|
297
289
|
|
|
298
290
|
var shared$3 = {exports: {}};
|
|
299
291
|
|
|
300
|
-
var global$
|
|
292
|
+
var global$8 = global$b;
|
|
301
293
|
|
|
302
294
|
// eslint-disable-next-line es-x/no-object-defineproperty -- safe
|
|
303
295
|
var defineProperty$1 = Object.defineProperty;
|
|
304
296
|
|
|
305
|
-
var
|
|
297
|
+
var defineGlobalProperty$3 = function (key, value) {
|
|
306
298
|
try {
|
|
307
|
-
defineProperty$1(global$
|
|
299
|
+
defineProperty$1(global$8, key, { value: value, configurable: true, writable: true });
|
|
308
300
|
} catch (error) {
|
|
309
|
-
global$
|
|
301
|
+
global$8[key] = value;
|
|
310
302
|
} return value;
|
|
311
303
|
};
|
|
312
304
|
|
|
313
|
-
var global$
|
|
314
|
-
var
|
|
305
|
+
var global$7 = global$b;
|
|
306
|
+
var defineGlobalProperty$2 = defineGlobalProperty$3;
|
|
315
307
|
|
|
316
308
|
var SHARED = '__core-js_shared__';
|
|
317
|
-
var store$3 = global$
|
|
309
|
+
var store$3 = global$7[SHARED] || defineGlobalProperty$2(SHARED, {});
|
|
318
310
|
|
|
319
311
|
var sharedStore = store$3;
|
|
320
312
|
|
|
@@ -323,22 +315,21 @@
|
|
|
323
315
|
(shared$3.exports = function (key, value) {
|
|
324
316
|
return store$2[key] || (store$2[key] = value !== undefined ? value : {});
|
|
325
317
|
})('versions', []).push({
|
|
326
|
-
version: '3.22.
|
|
318
|
+
version: '3.22.8',
|
|
327
319
|
mode: 'global',
|
|
328
320
|
copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',
|
|
329
|
-
license: 'https://github.com/zloirock/core-js/blob/v3.22.
|
|
321
|
+
license: 'https://github.com/zloirock/core-js/blob/v3.22.8/LICENSE',
|
|
330
322
|
source: 'https://github.com/zloirock/core-js'
|
|
331
323
|
});
|
|
332
324
|
|
|
333
|
-
var global$b = global$m;
|
|
334
325
|
var requireObjectCoercible = requireObjectCoercible$2;
|
|
335
326
|
|
|
336
|
-
var Object
|
|
327
|
+
var $Object = Object;
|
|
337
328
|
|
|
338
329
|
// `ToObject` abstract operation
|
|
339
330
|
// https://tc39.es/ecma262/#sec-toobject
|
|
340
331
|
var toObject$1 = function (argument) {
|
|
341
|
-
return Object
|
|
332
|
+
return $Object(requireObjectCoercible(argument));
|
|
342
333
|
};
|
|
343
334
|
|
|
344
335
|
var uncurryThis$5 = functionUncurryThis;
|
|
@@ -363,7 +354,7 @@
|
|
|
363
354
|
return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString$1(++id + postfix, 36);
|
|
364
355
|
};
|
|
365
356
|
|
|
366
|
-
var global$
|
|
357
|
+
var global$6 = global$b;
|
|
367
358
|
var shared$2 = shared$3.exports;
|
|
368
359
|
var hasOwn$6 = hasOwnProperty_1;
|
|
369
360
|
var uid$1 = uid$2;
|
|
@@ -371,7 +362,7 @@
|
|
|
371
362
|
var USE_SYMBOL_AS_UID = useSymbolAsUid;
|
|
372
363
|
|
|
373
364
|
var WellKnownSymbolsStore = shared$2('wks');
|
|
374
|
-
var Symbol$1 = global$
|
|
365
|
+
var Symbol$1 = global$6.Symbol;
|
|
375
366
|
var symbolFor = Symbol$1 && Symbol$1['for'];
|
|
376
367
|
var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid$1;
|
|
377
368
|
|
|
@@ -388,7 +379,6 @@
|
|
|
388
379
|
} return WellKnownSymbolsStore[name];
|
|
389
380
|
};
|
|
390
381
|
|
|
391
|
-
var global$9 = global$m;
|
|
392
382
|
var call$1 = functionCall;
|
|
393
383
|
var isObject$3 = isObject$5;
|
|
394
384
|
var isSymbol$1 = isSymbol$2;
|
|
@@ -396,7 +386,7 @@
|
|
|
396
386
|
var ordinaryToPrimitive = ordinaryToPrimitive$1;
|
|
397
387
|
var wellKnownSymbol = wellKnownSymbol$1;
|
|
398
388
|
|
|
399
|
-
var TypeError$
|
|
389
|
+
var $TypeError$2 = TypeError;
|
|
400
390
|
var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
|
|
401
391
|
|
|
402
392
|
// `ToPrimitive` abstract operation
|
|
@@ -409,7 +399,7 @@
|
|
|
409
399
|
if (pref === undefined) { pref = 'default'; }
|
|
410
400
|
result = call$1(exoticToPrim, input, pref);
|
|
411
401
|
if (!isObject$3(result) || isSymbol$1(result)) { return result; }
|
|
412
|
-
throw TypeError$
|
|
402
|
+
throw $TypeError$2("Can't convert object to primitive value");
|
|
413
403
|
}
|
|
414
404
|
if (pref === undefined) { pref = 'number'; }
|
|
415
405
|
return ordinaryToPrimitive(input, pref);
|
|
@@ -425,10 +415,10 @@
|
|
|
425
415
|
return isSymbol(key) ? key : key + '';
|
|
426
416
|
};
|
|
427
417
|
|
|
428
|
-
var global$
|
|
418
|
+
var global$5 = global$b;
|
|
429
419
|
var isObject$2 = isObject$5;
|
|
430
420
|
|
|
431
|
-
var document$1 = global$
|
|
421
|
+
var document$1 = global$5.document;
|
|
432
422
|
// typeof document.createElement is 'object' in old IE
|
|
433
423
|
var EXISTS$1 = isObject$2(document$1) && isObject$2(document$1.createElement);
|
|
434
424
|
|
|
@@ -486,26 +476,24 @@
|
|
|
486
476
|
}).prototype != 42;
|
|
487
477
|
});
|
|
488
478
|
|
|
489
|
-
var global$7 = global$m;
|
|
490
479
|
var isObject$1 = isObject$5;
|
|
491
480
|
|
|
492
|
-
var String
|
|
493
|
-
var TypeError$
|
|
481
|
+
var $String = String;
|
|
482
|
+
var $TypeError$1 = TypeError;
|
|
494
483
|
|
|
495
484
|
// `Assert: Type(argument) is Object`
|
|
496
485
|
var anObject$2 = function (argument) {
|
|
497
486
|
if (isObject$1(argument)) { return argument; }
|
|
498
|
-
throw TypeError$
|
|
487
|
+
throw $TypeError$1($String(argument) + ' is not an object');
|
|
499
488
|
};
|
|
500
489
|
|
|
501
|
-
var global$6 = global$m;
|
|
502
490
|
var DESCRIPTORS$3 = descriptors;
|
|
503
491
|
var IE8_DOM_DEFINE = ie8DomDefine;
|
|
504
492
|
var V8_PROTOTYPE_DEFINE_BUG = v8PrototypeDefineBug;
|
|
505
493
|
var anObject$1 = anObject$2;
|
|
506
494
|
var toPropertyKey = toPropertyKey$2;
|
|
507
495
|
|
|
508
|
-
var TypeError
|
|
496
|
+
var $TypeError = TypeError;
|
|
509
497
|
// eslint-disable-next-line es-x/no-object-defineproperty -- safe
|
|
510
498
|
var $defineProperty = Object.defineProperty;
|
|
511
499
|
// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
|
|
@@ -538,7 +526,7 @@
|
|
|
538
526
|
if (IE8_DOM_DEFINE) { try {
|
|
539
527
|
return $defineProperty(O, P, Attributes);
|
|
540
528
|
} catch (error) { /* empty */ } }
|
|
541
|
-
if ('get' in Attributes || 'set' in Attributes) { throw TypeError
|
|
529
|
+
if ('get' in Attributes || 'set' in Attributes) { throw $TypeError('Accessors not supported'); }
|
|
542
530
|
if ('value' in Attributes) { O[P] = Attributes.value; }
|
|
543
531
|
return O;
|
|
544
532
|
};
|
|
@@ -589,11 +577,11 @@
|
|
|
589
577
|
|
|
590
578
|
var inspectSource$2 = store$1.inspectSource;
|
|
591
579
|
|
|
592
|
-
var global$
|
|
580
|
+
var global$4 = global$b;
|
|
593
581
|
var isCallable$3 = isCallable$a;
|
|
594
582
|
var inspectSource$1 = inspectSource$2;
|
|
595
583
|
|
|
596
|
-
var WeakMap$1 = global$
|
|
584
|
+
var WeakMap$1 = global$4.WeakMap;
|
|
597
585
|
|
|
598
586
|
var nativeWeakMap = isCallable$3(WeakMap$1) && /native code/.test(inspectSource$1(WeakMap$1));
|
|
599
587
|
|
|
@@ -609,7 +597,7 @@
|
|
|
609
597
|
var hiddenKeys$3 = {};
|
|
610
598
|
|
|
611
599
|
var NATIVE_WEAK_MAP = nativeWeakMap;
|
|
612
|
-
var global$
|
|
600
|
+
var global$3 = global$b;
|
|
613
601
|
var uncurryThis$2 = functionUncurryThis;
|
|
614
602
|
var isObject = isObject$5;
|
|
615
603
|
var createNonEnumerableProperty$2 = createNonEnumerableProperty$3;
|
|
@@ -619,8 +607,8 @@
|
|
|
619
607
|
var hiddenKeys$2 = hiddenKeys$3;
|
|
620
608
|
|
|
621
609
|
var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
|
|
622
|
-
var TypeError$1 = global$
|
|
623
|
-
var WeakMap = global$
|
|
610
|
+
var TypeError$1 = global$3.TypeError;
|
|
611
|
+
var WeakMap = global$3.WeakMap;
|
|
624
612
|
var set, get, has;
|
|
625
613
|
|
|
626
614
|
var enforce = function (it) {
|
|
@@ -709,11 +697,12 @@
|
|
|
709
697
|
if (CONFIGURABLE_LENGTH && options && hasOwn$2(options, 'arity') && value.length !== options.arity) {
|
|
710
698
|
defineProperty(value, 'length', { value: options.arity });
|
|
711
699
|
}
|
|
712
|
-
|
|
713
|
-
if (
|
|
714
|
-
defineProperty(value, 'prototype', { writable: false });
|
|
715
|
-
|
|
716
|
-
|
|
700
|
+
try {
|
|
701
|
+
if (options && hasOwn$2(options, 'constructor') && options.constructor) {
|
|
702
|
+
if (DESCRIPTORS) { defineProperty(value, 'prototype', { writable: false }); }
|
|
703
|
+
// in V8 ~ Chrome 53, prototypes of some methods, like `Array.prototype.values`, are non-writable
|
|
704
|
+
} else if (value.prototype) { value.prototype = undefined; }
|
|
705
|
+
} catch (error) { /* empty */ }
|
|
717
706
|
var state = enforceInternalState(value);
|
|
718
707
|
if (!hasOwn$2(state, 'source')) {
|
|
719
708
|
state.source = TEMPLATE.join(typeof name == 'string' ? name : '');
|
|
@@ -726,30 +715,25 @@
|
|
|
726
715
|
return isCallable$2(this) && getInternalState(this).source || inspectSource(this);
|
|
727
716
|
}, 'toString');
|
|
728
717
|
|
|
729
|
-
var global$3 = global$m;
|
|
730
718
|
var isCallable$1 = isCallable$a;
|
|
731
719
|
var createNonEnumerableProperty$1 = createNonEnumerableProperty$3;
|
|
732
720
|
var makeBuiltIn = makeBuiltIn$2.exports;
|
|
733
|
-
var
|
|
721
|
+
var defineGlobalProperty$1 = defineGlobalProperty$3;
|
|
734
722
|
|
|
735
723
|
var defineBuiltIn$1 = function (O, key, value, options) {
|
|
736
|
-
|
|
737
|
-
var simple = options
|
|
738
|
-
var
|
|
739
|
-
var name = options && options.name !== undefined ? options.name : key;
|
|
724
|
+
if (!options) { options = {}; }
|
|
725
|
+
var simple = options.enumerable;
|
|
726
|
+
var name = options.name !== undefined ? options.name : key;
|
|
740
727
|
if (isCallable$1(value)) { makeBuiltIn(value, name, options); }
|
|
741
|
-
if (
|
|
728
|
+
if (options.global) {
|
|
742
729
|
if (simple) { O[key] = value; }
|
|
743
|
-
else {
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
}
|
|
750
|
-
if (simple) { O[key] = value; }
|
|
751
|
-
else { createNonEnumerableProperty$1(O, key, value); }
|
|
752
|
-
return O;
|
|
730
|
+
else { defineGlobalProperty$1(key, value); }
|
|
731
|
+
} else {
|
|
732
|
+
if (!options.unsafe) { delete O[key]; }
|
|
733
|
+
else if (O[key]) { simple = true; }
|
|
734
|
+
if (simple) { O[key] = value; }
|
|
735
|
+
else { createNonEnumerableProperty$1(O, key, value); }
|
|
736
|
+
} return O;
|
|
753
737
|
};
|
|
754
738
|
|
|
755
739
|
var objectGetOwnPropertyNames = {};
|
|
@@ -757,12 +741,22 @@
|
|
|
757
741
|
var ceil = Math.ceil;
|
|
758
742
|
var floor = Math.floor;
|
|
759
743
|
|
|
744
|
+
// `Math.trunc` method
|
|
745
|
+
// https://tc39.es/ecma262/#sec-math.trunc
|
|
746
|
+
// eslint-disable-next-line es-x/no-math-trunc -- safe
|
|
747
|
+
var mathTrunc = Math.trunc || function trunc(x) {
|
|
748
|
+
var n = +x;
|
|
749
|
+
return (n > 0 ? floor : ceil)(n);
|
|
750
|
+
};
|
|
751
|
+
|
|
752
|
+
var trunc = mathTrunc;
|
|
753
|
+
|
|
760
754
|
// `ToIntegerOrInfinity` abstract operation
|
|
761
755
|
// https://tc39.es/ecma262/#sec-tointegerorinfinity
|
|
762
756
|
var toIntegerOrInfinity$2 = function (argument) {
|
|
763
757
|
var number = +argument;
|
|
764
|
-
// eslint-disable-next-line no-self-compare --
|
|
765
|
-
return number !== number || number === 0 ? 0 : (number
|
|
758
|
+
// eslint-disable-next-line no-self-compare -- NaN check
|
|
759
|
+
return number !== number || number === 0 ? 0 : trunc(number);
|
|
766
760
|
};
|
|
767
761
|
|
|
768
762
|
var toIntegerOrInfinity$1 = toIntegerOrInfinity$2;
|
|
@@ -933,28 +927,28 @@
|
|
|
933
927
|
|
|
934
928
|
var isForced_1 = isForced$1;
|
|
935
929
|
|
|
936
|
-
var global$2 = global$
|
|
930
|
+
var global$2 = global$b;
|
|
937
931
|
var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
|
|
938
932
|
var createNonEnumerableProperty = createNonEnumerableProperty$3;
|
|
939
933
|
var defineBuiltIn = defineBuiltIn$1;
|
|
940
|
-
var
|
|
934
|
+
var defineGlobalProperty = defineGlobalProperty$3;
|
|
941
935
|
var copyConstructorProperties = copyConstructorProperties$1;
|
|
942
936
|
var isForced = isForced_1;
|
|
943
937
|
|
|
944
938
|
/*
|
|
945
|
-
options.target
|
|
946
|
-
options.global
|
|
947
|
-
options.stat
|
|
948
|
-
options.proto
|
|
949
|
-
options.real
|
|
950
|
-
options.forced
|
|
951
|
-
options.bind
|
|
952
|
-
options.wrap
|
|
953
|
-
options.unsafe
|
|
954
|
-
options.sham
|
|
955
|
-
options.enumerable
|
|
956
|
-
options.
|
|
957
|
-
options.name
|
|
939
|
+
options.target - name of the target object
|
|
940
|
+
options.global - target is the global object
|
|
941
|
+
options.stat - export as static methods of target
|
|
942
|
+
options.proto - export as prototype methods of target
|
|
943
|
+
options.real - real prototype method for the `pure` version
|
|
944
|
+
options.forced - export even if the native feature is available
|
|
945
|
+
options.bind - bind methods to the target, required for the `pure` version
|
|
946
|
+
options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
|
|
947
|
+
options.unsafe - use the simple assignment of property instead of delete + defineProperty
|
|
948
|
+
options.sham - add a flag to not completely full polyfills
|
|
949
|
+
options.enumerable - export as enumerable property
|
|
950
|
+
options.dontCallGetSet - prevent calling a getter on target
|
|
951
|
+
options.name - the .name of the function if it does not match the key
|
|
958
952
|
*/
|
|
959
953
|
var _export = function (options, source) {
|
|
960
954
|
var TARGET = options.target;
|
|
@@ -964,13 +958,13 @@
|
|
|
964
958
|
if (GLOBAL) {
|
|
965
959
|
target = global$2;
|
|
966
960
|
} else if (STATIC) {
|
|
967
|
-
target = global$2[TARGET] ||
|
|
961
|
+
target = global$2[TARGET] || defineGlobalProperty(TARGET, {});
|
|
968
962
|
} else {
|
|
969
963
|
target = (global$2[TARGET] || {}).prototype;
|
|
970
964
|
}
|
|
971
965
|
if (target) { for (key in source) {
|
|
972
966
|
sourceProperty = source[key];
|
|
973
|
-
if (options.
|
|
967
|
+
if (options.dontCallGetSet) {
|
|
974
968
|
descriptor = getOwnPropertyDescriptor(target, key);
|
|
975
969
|
targetProperty = descriptor && descriptor.value;
|
|
976
970
|
} else { targetProperty = target[key]; }
|
|
@@ -989,7 +983,7 @@
|
|
|
989
983
|
};
|
|
990
984
|
|
|
991
985
|
var $ = _export;
|
|
992
|
-
var global$1 = global$
|
|
986
|
+
var global$1 = global$b;
|
|
993
987
|
|
|
994
988
|
// `globalThis` object
|
|
995
989
|
// https://tc39.es/ecma262/#sec-globalthis
|
|
@@ -2507,7 +2501,7 @@
|
|
|
2507
2501
|
this.onResetEvent(r, g, b, alpha);
|
|
2508
2502
|
};
|
|
2509
2503
|
|
|
2510
|
-
var prototypeAccessors$
|
|
2504
|
+
var prototypeAccessors$5 = { r: { configurable: true },g: { configurable: true },b: { configurable: true },alpha: { configurable: true } };
|
|
2511
2505
|
|
|
2512
2506
|
/**
|
|
2513
2507
|
* @ignore
|
|
@@ -2534,11 +2528,11 @@
|
|
|
2534
2528
|
* @type {number}
|
|
2535
2529
|
* @memberof Color
|
|
2536
2530
|
*/
|
|
2537
|
-
prototypeAccessors$
|
|
2531
|
+
prototypeAccessors$5.r.get = function () {
|
|
2538
2532
|
return ~~(this.glArray[0] * 255);
|
|
2539
2533
|
};
|
|
2540
2534
|
|
|
2541
|
-
prototypeAccessors$
|
|
2535
|
+
prototypeAccessors$5.r.set = function (value) {
|
|
2542
2536
|
this.glArray[0] = clamp(~~value || 0, 0, 255) / 255.0;
|
|
2543
2537
|
};
|
|
2544
2538
|
|
|
@@ -2548,11 +2542,11 @@
|
|
|
2548
2542
|
* @type {number}
|
|
2549
2543
|
* @memberof Color
|
|
2550
2544
|
*/
|
|
2551
|
-
prototypeAccessors$
|
|
2545
|
+
prototypeAccessors$5.g.get = function () {
|
|
2552
2546
|
return ~~(this.glArray[1] * 255);
|
|
2553
2547
|
};
|
|
2554
2548
|
|
|
2555
|
-
prototypeAccessors$
|
|
2549
|
+
prototypeAccessors$5.g.set = function (value) {
|
|
2556
2550
|
this.glArray[1] = clamp(~~value || 0, 0, 255) / 255.0;
|
|
2557
2551
|
};
|
|
2558
2552
|
|
|
@@ -2562,10 +2556,10 @@
|
|
|
2562
2556
|
* @type {number}
|
|
2563
2557
|
* @memberof Color
|
|
2564
2558
|
*/
|
|
2565
|
-
prototypeAccessors$
|
|
2559
|
+
prototypeAccessors$5.b.get = function () {
|
|
2566
2560
|
return ~~(this.glArray[2] * 255);
|
|
2567
2561
|
};
|
|
2568
|
-
prototypeAccessors$
|
|
2562
|
+
prototypeAccessors$5.b.set = function (value) {
|
|
2569
2563
|
this.glArray[2] = clamp(~~value || 0, 0, 255) / 255.0;
|
|
2570
2564
|
};
|
|
2571
2565
|
|
|
@@ -2574,11 +2568,11 @@
|
|
|
2574
2568
|
* @type {number}
|
|
2575
2569
|
* @memberof Color
|
|
2576
2570
|
*/
|
|
2577
|
-
prototypeAccessors$
|
|
2571
|
+
prototypeAccessors$5.alpha.get = function () {
|
|
2578
2572
|
return this.glArray[3];
|
|
2579
2573
|
};
|
|
2580
2574
|
|
|
2581
|
-
prototypeAccessors$
|
|
2575
|
+
prototypeAccessors$5.alpha.set = function (value) {
|
|
2582
2576
|
this.glArray[3] = typeof(value) === "undefined" ? 1.0 : clamp(+value, 0, 1.0);
|
|
2583
2577
|
};
|
|
2584
2578
|
|
|
@@ -2900,11 +2894,13 @@
|
|
|
2900
2894
|
* @function
|
|
2901
2895
|
* @returns {string}
|
|
2902
2896
|
*/
|
|
2903
|
-
Color.prototype.toHex8 = function toHex8 () {
|
|
2897
|
+
Color.prototype.toHex8 = function toHex8 (alpha) {
|
|
2898
|
+
if ( alpha === void 0 ) alpha = this.alpha;
|
|
2899
|
+
|
|
2904
2900
|
// TODO : Memoize this function by caching its result until any of
|
|
2905
2901
|
// the r,g,b,a values are changed
|
|
2906
2902
|
|
|
2907
|
-
return "#" + toHex(this.r) + toHex(this.g) + toHex(this.b) + toHex(
|
|
2903
|
+
return "#" + toHex(this.r) + toHex(this.g) + toHex(this.b) + toHex(alpha * 255);
|
|
2908
2904
|
};
|
|
2909
2905
|
|
|
2910
2906
|
/**
|
|
@@ -2930,9 +2926,12 @@
|
|
|
2930
2926
|
* @name toRGBA
|
|
2931
2927
|
* @memberof Color
|
|
2932
2928
|
* @function
|
|
2929
|
+
* @param {number} [alpha=1.0] alpha value [0.0 .. 1.0]
|
|
2933
2930
|
* @returns {string}
|
|
2934
2931
|
*/
|
|
2935
|
-
Color.prototype.toRGBA = function toRGBA () {
|
|
2932
|
+
Color.prototype.toRGBA = function toRGBA (alpha) {
|
|
2933
|
+
if ( alpha === void 0 ) alpha = this.alpha;
|
|
2934
|
+
|
|
2936
2935
|
// TODO : Memoize this function by caching its result until any of
|
|
2937
2936
|
// the r,g,b,a values are changed
|
|
2938
2937
|
|
|
@@ -2940,11 +2939,11 @@
|
|
|
2940
2939
|
this.r + "," +
|
|
2941
2940
|
this.g + "," +
|
|
2942
2941
|
this.b + "," +
|
|
2943
|
-
|
|
2942
|
+
alpha +
|
|
2944
2943
|
")";
|
|
2945
2944
|
};
|
|
2946
2945
|
|
|
2947
|
-
Object.defineProperties( Color.prototype, prototypeAccessors$
|
|
2946
|
+
Object.defineProperties( Color.prototype, prototypeAccessors$5 );
|
|
2948
2947
|
|
|
2949
2948
|
/**
|
|
2950
2949
|
* @classdesc
|
|
@@ -2958,7 +2957,7 @@
|
|
|
2958
2957
|
(ref = this).onResetEvent.apply(ref, args);
|
|
2959
2958
|
};
|
|
2960
2959
|
|
|
2961
|
-
var prototypeAccessors$
|
|
2960
|
+
var prototypeAccessors$4 = { tx: { configurable: true },ty: { configurable: true },tz: { configurable: true } };
|
|
2962
2961
|
|
|
2963
2962
|
/**
|
|
2964
2963
|
* @ignore
|
|
@@ -2986,7 +2985,7 @@
|
|
|
2986
2985
|
* @name tx
|
|
2987
2986
|
* @memberof Matrix3d
|
|
2988
2987
|
*/
|
|
2989
|
-
prototypeAccessors$
|
|
2988
|
+
prototypeAccessors$4.tx.get = function () {
|
|
2990
2989
|
return this.val[12];
|
|
2991
2990
|
};
|
|
2992
2991
|
|
|
@@ -2997,7 +2996,7 @@
|
|
|
2997
2996
|
* @name ty
|
|
2998
2997
|
* @memberof Matrix3d
|
|
2999
2998
|
*/
|
|
3000
|
-
prototypeAccessors$
|
|
2999
|
+
prototypeAccessors$4.ty.get = function () {
|
|
3001
3000
|
return this.val[13];
|
|
3002
3001
|
};
|
|
3003
3002
|
|
|
@@ -3008,7 +3007,7 @@
|
|
|
3008
3007
|
* @name tz
|
|
3009
3008
|
* @memberof Matrix3d
|
|
3010
3009
|
*/
|
|
3011
|
-
prototypeAccessors$
|
|
3010
|
+
prototypeAccessors$4.tz.get = function () {
|
|
3012
3011
|
return this.val[14];
|
|
3013
3012
|
};
|
|
3014
3013
|
|
|
@@ -3636,7 +3635,7 @@
|
|
|
3636
3635
|
")";
|
|
3637
3636
|
};
|
|
3638
3637
|
|
|
3639
|
-
Object.defineProperties( Matrix3d.prototype, prototypeAccessors$
|
|
3638
|
+
Object.defineProperties( Matrix3d.prototype, prototypeAccessors$4 );
|
|
3640
3639
|
|
|
3641
3640
|
/**
|
|
3642
3641
|
* @classdesc
|
|
@@ -3652,7 +3651,7 @@
|
|
|
3652
3651
|
(ref = this).onResetEvent.apply(ref, args);
|
|
3653
3652
|
};
|
|
3654
3653
|
|
|
3655
|
-
var prototypeAccessors$
|
|
3654
|
+
var prototypeAccessors$3 = { tx: { configurable: true },ty: { configurable: true } };
|
|
3656
3655
|
|
|
3657
3656
|
/**
|
|
3658
3657
|
* @ignore
|
|
@@ -3685,7 +3684,7 @@
|
|
|
3685
3684
|
* @name tx
|
|
3686
3685
|
* @memberof Matrix2d
|
|
3687
3686
|
*/
|
|
3688
|
-
prototypeAccessors$
|
|
3687
|
+
prototypeAccessors$3.tx.get = function () {
|
|
3689
3688
|
return this.val[6];
|
|
3690
3689
|
};
|
|
3691
3690
|
|
|
@@ -3697,7 +3696,7 @@
|
|
|
3697
3696
|
* @name ty
|
|
3698
3697
|
* @memberof Matrix2d
|
|
3699
3698
|
*/
|
|
3700
|
-
prototypeAccessors$
|
|
3699
|
+
prototypeAccessors$3.ty.get = function () {
|
|
3701
3700
|
return this.val[7];
|
|
3702
3701
|
};
|
|
3703
3702
|
|
|
@@ -4144,7 +4143,7 @@
|
|
|
4144
4143
|
")";
|
|
4145
4144
|
};
|
|
4146
4145
|
|
|
4147
|
-
Object.defineProperties( Matrix2d.prototype, prototypeAccessors$
|
|
4146
|
+
Object.defineProperties( Matrix2d.prototype, prototypeAccessors$3 );
|
|
4148
4147
|
|
|
4149
4148
|
var eventemitter3 = {exports: {}};
|
|
4150
4149
|
|
|
@@ -10574,7 +10573,7 @@
|
|
|
10574
10573
|
* @public
|
|
10575
10574
|
* @type {Vector2d}
|
|
10576
10575
|
* @name pos
|
|
10577
|
-
* @memberof Polygon
|
|
10576
|
+
* @memberof Polygon
|
|
10578
10577
|
*/
|
|
10579
10578
|
this.pos = pool$1.pull("Vector2d");
|
|
10580
10579
|
|
|
@@ -10583,7 +10582,7 @@
|
|
|
10583
10582
|
* @ignore
|
|
10584
10583
|
* @type {Bounds}
|
|
10585
10584
|
* @name _bounds
|
|
10586
|
-
* @memberof Polygon
|
|
10585
|
+
* @memberof Polygon
|
|
10587
10586
|
*/
|
|
10588
10587
|
this._bounds;
|
|
10589
10588
|
|
|
@@ -10593,7 +10592,7 @@
|
|
|
10593
10592
|
* @public
|
|
10594
10593
|
* @type {Vector2d[]}
|
|
10595
10594
|
* @name points
|
|
10596
|
-
* @memberof Polygon
|
|
10595
|
+
* @memberof Polygon
|
|
10597
10596
|
*/
|
|
10598
10597
|
this.points = [];
|
|
10599
10598
|
|
|
@@ -10632,7 +10631,7 @@
|
|
|
10632
10631
|
/**
|
|
10633
10632
|
* set new value to the Polygon
|
|
10634
10633
|
* @name setShape
|
|
10635
|
-
* @memberof Polygon
|
|
10634
|
+
* @memberof Polygon
|
|
10636
10635
|
* @function
|
|
10637
10636
|
* @param {number} x position of the Polygon
|
|
10638
10637
|
* @param {number} y position of the Polygon
|
|
@@ -10648,7 +10647,7 @@
|
|
|
10648
10647
|
/**
|
|
10649
10648
|
* set the vertices defining this Polygon
|
|
10650
10649
|
* @name setVertices
|
|
10651
|
-
* @memberof Polygon
|
|
10650
|
+
* @memberof Polygon
|
|
10652
10651
|
* @function
|
|
10653
10652
|
* @param {Vector2d[]} vertices array of vector or vertice defining the Polygon
|
|
10654
10653
|
* @returns {Polygon} this instance for objecf chaining
|
|
@@ -10690,7 +10689,7 @@
|
|
|
10690
10689
|
/**
|
|
10691
10690
|
* apply the given transformation matrix to this Polygon
|
|
10692
10691
|
* @name transform
|
|
10693
|
-
* @memberof Polygon
|
|
10692
|
+
* @memberof Polygon
|
|
10694
10693
|
* @function
|
|
10695
10694
|
* @param {Matrix2d} m the transformation matrix
|
|
10696
10695
|
* @returns {Polygon} Reference to this object for method chaining
|
|
@@ -10709,7 +10708,7 @@
|
|
|
10709
10708
|
/**
|
|
10710
10709
|
* apply an isometric projection to this shape
|
|
10711
10710
|
* @name toIso
|
|
10712
|
-
* @memberof Polygon
|
|
10711
|
+
* @memberof Polygon
|
|
10713
10712
|
* @function
|
|
10714
10713
|
* @returns {Polygon} Reference to this object for method chaining
|
|
10715
10714
|
*/
|
|
@@ -10720,7 +10719,7 @@
|
|
|
10720
10719
|
/**
|
|
10721
10720
|
* apply a 2d projection to this shape
|
|
10722
10721
|
* @name to2d
|
|
10723
|
-
* @memberof Polygon
|
|
10722
|
+
* @memberof Polygon
|
|
10724
10723
|
* @function
|
|
10725
10724
|
* @returns {Polygon} Reference to this object for method chaining
|
|
10726
10725
|
*/
|
|
@@ -10731,7 +10730,7 @@
|
|
|
10731
10730
|
/**
|
|
10732
10731
|
* Rotate this Polygon (counter-clockwise) by the specified angle (in radians).
|
|
10733
10732
|
* @name rotate
|
|
10734
|
-
* @memberof Polygon
|
|
10733
|
+
* @memberof Polygon
|
|
10735
10734
|
* @function
|
|
10736
10735
|
* @param {number} angle The angle to rotate (in radians)
|
|
10737
10736
|
* @param {Vector2d|ObservableVector2d} [v] an optional point to rotate around
|
|
@@ -10753,7 +10752,7 @@
|
|
|
10753
10752
|
/**
|
|
10754
10753
|
* Scale this Polygon by the given scalar.
|
|
10755
10754
|
* @name scale
|
|
10756
|
-
* @memberof Polygon
|
|
10755
|
+
* @memberof Polygon
|
|
10757
10756
|
* @function
|
|
10758
10757
|
* @param {number} x
|
|
10759
10758
|
* @param {number} [y=x]
|
|
@@ -10775,7 +10774,7 @@
|
|
|
10775
10774
|
/**
|
|
10776
10775
|
* Scale this Polygon by the given vector
|
|
10777
10776
|
* @name scaleV
|
|
10778
|
-
* @memberof Polygon
|
|
10777
|
+
* @memberof Polygon
|
|
10779
10778
|
* @function
|
|
10780
10779
|
* @param {Vector2d} v
|
|
10781
10780
|
* @returns {Polygon} Reference to this object for method chaining
|
|
@@ -10788,7 +10787,7 @@
|
|
|
10788
10787
|
* Computes the calculated collision polygon.
|
|
10789
10788
|
* This **must** be called if the `points` array, `angle`, or `offset` is modified manually.
|
|
10790
10789
|
* @name recalc
|
|
10791
|
-
* @memberof Polygon
|
|
10790
|
+
* @memberof Polygon
|
|
10792
10791
|
* @function
|
|
10793
10792
|
* @returns {Polygon} Reference to this object for method chaining
|
|
10794
10793
|
*/
|
|
@@ -10832,7 +10831,7 @@
|
|
|
10832
10831
|
/**
|
|
10833
10832
|
* returns a list of indices for all triangles defined in this polygon
|
|
10834
10833
|
* @name getIndices
|
|
10835
|
-
* @memberof Polygon
|
|
10834
|
+
* @memberof Polygon
|
|
10836
10835
|
* @function
|
|
10837
10836
|
* @returns {Array} an array of vertex indices for all triangles forming this polygon.
|
|
10838
10837
|
*/
|
|
@@ -10846,7 +10845,7 @@
|
|
|
10846
10845
|
/**
|
|
10847
10846
|
* Returns true if the vertices composing this polygon form a convex shape (vertices must be in clockwise order).
|
|
10848
10847
|
* @name isConvex
|
|
10849
|
-
* @memberof Polygon
|
|
10848
|
+
* @memberof Polygon
|
|
10850
10849
|
* @function
|
|
10851
10850
|
* @returns {boolean} true if the vertices are convex, false if not, null if not computable
|
|
10852
10851
|
*/
|
|
@@ -10893,7 +10892,7 @@
|
|
|
10893
10892
|
/**
|
|
10894
10893
|
* translate the Polygon by the specified offset
|
|
10895
10894
|
* @name translate
|
|
10896
|
-
* @memberof Polygon
|
|
10895
|
+
* @memberof Polygon
|
|
10897
10896
|
* @function
|
|
10898
10897
|
* @param {number} x x offset
|
|
10899
10898
|
* @param {number} y y offset
|
|
@@ -10902,7 +10901,7 @@
|
|
|
10902
10901
|
/**
|
|
10903
10902
|
* translate the Polygon by the specified vector
|
|
10904
10903
|
* @name translate
|
|
10905
|
-
* @memberof Polygon
|
|
10904
|
+
* @memberof Polygon
|
|
10906
10905
|
* @function
|
|
10907
10906
|
* @param {Vector2d} v vector offset
|
|
10908
10907
|
* @returns {Polygon} Reference to this object for method chaining
|
|
@@ -10930,14 +10929,14 @@
|
|
|
10930
10929
|
/**
|
|
10931
10930
|
* Shifts the Polygon to the given position vector.
|
|
10932
10931
|
* @name shift
|
|
10933
|
-
* @memberof Polygon
|
|
10932
|
+
* @memberof Polygon
|
|
10934
10933
|
* @function
|
|
10935
10934
|
* @param {Vector2d} position
|
|
10936
10935
|
*/
|
|
10937
10936
|
/**
|
|
10938
10937
|
* Shifts the Polygon to the given x, y position.
|
|
10939
10938
|
* @name shift
|
|
10940
|
-
* @memberof Polygon
|
|
10939
|
+
* @memberof Polygon
|
|
10941
10940
|
* @function
|
|
10942
10941
|
* @param {number} x
|
|
10943
10942
|
* @param {number} y
|
|
@@ -10963,7 +10962,7 @@
|
|
|
10963
10962
|
* (Note: it is highly recommended to first do a hit test on the corresponding <br>
|
|
10964
10963
|
* bounding rect, as the function can be highly consuming with complex shapes)
|
|
10965
10964
|
* @name contains
|
|
10966
|
-
* @memberof Polygon
|
|
10965
|
+
* @memberof Polygon
|
|
10967
10966
|
* @function
|
|
10968
10967
|
* @param {Vector2d} point
|
|
10969
10968
|
* @returns {boolean} true if contains
|
|
@@ -10974,7 +10973,7 @@
|
|
|
10974
10973
|
* (Note: it is highly recommended to first do a hit test on the corresponding <br>
|
|
10975
10974
|
* bounding rect, as the function can be highly consuming with complex shapes)
|
|
10976
10975
|
* @name contains
|
|
10977
|
-
* @memberof Polygon
|
|
10976
|
+
* @memberof Polygon
|
|
10978
10977
|
* @function
|
|
10979
10978
|
* @param {number} x x coordinate
|
|
10980
10979
|
* @param {number} y y coordinate
|
|
@@ -11012,7 +11011,7 @@
|
|
|
11012
11011
|
/**
|
|
11013
11012
|
* returns the bounding box for this shape, the smallest Rectangle object completely containing this shape.
|
|
11014
11013
|
* @name getBounds
|
|
11015
|
-
* @memberof Polygon
|
|
11014
|
+
* @memberof Polygon
|
|
11016
11015
|
* @function
|
|
11017
11016
|
* @returns {Bounds} this shape bounding box Rectangle object
|
|
11018
11017
|
*/
|
|
@@ -11027,7 +11026,7 @@
|
|
|
11027
11026
|
* update the bounding box for this shape.
|
|
11028
11027
|
* @ignore
|
|
11029
11028
|
* @name updateBounds
|
|
11030
|
-
* @memberof Polygon
|
|
11029
|
+
* @memberof Polygon
|
|
11031
11030
|
* @function
|
|
11032
11031
|
* @returns {Bounds} this shape bounding box Rectangle object
|
|
11033
11032
|
*/
|
|
@@ -11043,7 +11042,7 @@
|
|
|
11043
11042
|
/**
|
|
11044
11043
|
* clone this Polygon
|
|
11045
11044
|
* @name clone
|
|
11046
|
-
* @memberof Polygon
|
|
11045
|
+
* @memberof Polygon
|
|
11047
11046
|
* @function
|
|
11048
11047
|
* @returns {Polygon} new Polygon
|
|
11049
11048
|
*/
|
|
@@ -11060,7 +11059,7 @@
|
|
|
11060
11059
|
* a rectangle Object
|
|
11061
11060
|
* @augments Polygon
|
|
11062
11061
|
*/
|
|
11063
|
-
var Rect = /*@__PURE__*/(function (Polygon) {
|
|
11062
|
+
var Rect$1 = /*@__PURE__*/(function (Polygon) {
|
|
11064
11063
|
function Rect(x, y, w, h) {
|
|
11065
11064
|
// parent constructor
|
|
11066
11065
|
Polygon.call(this, x, y, [
|
|
@@ -11085,7 +11084,7 @@
|
|
|
11085
11084
|
/**
|
|
11086
11085
|
* set new value to the rectangle shape
|
|
11087
11086
|
* @name setShape
|
|
11088
|
-
* @memberof Rect
|
|
11087
|
+
* @memberof Rect
|
|
11089
11088
|
* @function
|
|
11090
11089
|
* @param {number} x position of the Rectangle
|
|
11091
11090
|
* @param {number} y position of the Rectangle
|
|
@@ -11116,7 +11115,7 @@
|
|
|
11116
11115
|
* @public
|
|
11117
11116
|
* @type {number}
|
|
11118
11117
|
* @name left
|
|
11119
|
-
* @memberof Rect
|
|
11118
|
+
* @memberof Rect
|
|
11120
11119
|
*/
|
|
11121
11120
|
prototypeAccessors.left.get = function () {
|
|
11122
11121
|
return this.pos.x;
|
|
@@ -11127,7 +11126,7 @@
|
|
|
11127
11126
|
* @public
|
|
11128
11127
|
* @type {number}
|
|
11129
11128
|
* @name right
|
|
11130
|
-
* @memberof Rect
|
|
11129
|
+
* @memberof Rect
|
|
11131
11130
|
*/
|
|
11132
11131
|
prototypeAccessors.right.get = function () {
|
|
11133
11132
|
var w = this.width;
|
|
@@ -11139,7 +11138,7 @@
|
|
|
11139
11138
|
* @public
|
|
11140
11139
|
* @type {number}
|
|
11141
11140
|
* @name top
|
|
11142
|
-
* @memberof Rect
|
|
11141
|
+
* @memberof Rect
|
|
11143
11142
|
*/
|
|
11144
11143
|
prototypeAccessors.top.get = function () {
|
|
11145
11144
|
return this.pos.y;
|
|
@@ -11150,7 +11149,7 @@
|
|
|
11150
11149
|
* @public
|
|
11151
11150
|
* @type {number}
|
|
11152
11151
|
* @name bottom
|
|
11153
|
-
* @memberof Rect
|
|
11152
|
+
* @memberof Rect
|
|
11154
11153
|
*/
|
|
11155
11154
|
prototypeAccessors.bottom.get = function () {
|
|
11156
11155
|
var h = this.height;
|
|
@@ -11162,7 +11161,7 @@
|
|
|
11162
11161
|
* @public
|
|
11163
11162
|
* @type {number}
|
|
11164
11163
|
* @name width
|
|
11165
|
-
* @memberof Rect
|
|
11164
|
+
* @memberof Rect
|
|
11166
11165
|
*/
|
|
11167
11166
|
prototypeAccessors.width.get = function () {
|
|
11168
11167
|
return this.points[2].x;
|
|
@@ -11178,7 +11177,7 @@
|
|
|
11178
11177
|
* @public
|
|
11179
11178
|
* @type {number}
|
|
11180
11179
|
* @name height
|
|
11181
|
-
* @memberof Rect
|
|
11180
|
+
* @memberof Rect
|
|
11182
11181
|
*/
|
|
11183
11182
|
prototypeAccessors.height.get = function () {
|
|
11184
11183
|
return this.points[2].y;
|
|
@@ -11194,7 +11193,7 @@
|
|
|
11194
11193
|
* @public
|
|
11195
11194
|
* @type {number}
|
|
11196
11195
|
* @name centerX
|
|
11197
|
-
* @memberof Rect
|
|
11196
|
+
* @memberof Rect
|
|
11198
11197
|
*/
|
|
11199
11198
|
prototypeAccessors.centerX.get = function () {
|
|
11200
11199
|
if (isFinite(this.width)) {
|
|
@@ -11212,7 +11211,7 @@
|
|
|
11212
11211
|
* @public
|
|
11213
11212
|
* @type {number}
|
|
11214
11213
|
* @name centerY
|
|
11215
|
-
* @memberof Rect
|
|
11214
|
+
* @memberof Rect
|
|
11216
11215
|
*/
|
|
11217
11216
|
prototypeAccessors.centerY.get = function () {
|
|
11218
11217
|
if (isFinite(this.height)) {
|
|
@@ -11228,7 +11227,7 @@
|
|
|
11228
11227
|
/**
|
|
11229
11228
|
* center the rectangle position around the given coordinates
|
|
11230
11229
|
* @name centerOn
|
|
11231
|
-
* @memberof Rect
|
|
11230
|
+
* @memberof Rect
|
|
11232
11231
|
* @function
|
|
11233
11232
|
* @param {number} x the x coordinate around which to center this rectangle
|
|
11234
11233
|
* @param {number} x the y coordinate around which to center this rectangle
|
|
@@ -11243,7 +11242,7 @@
|
|
|
11243
11242
|
/**
|
|
11244
11243
|
* resize the rectangle
|
|
11245
11244
|
* @name resize
|
|
11246
|
-
* @memberof Rect
|
|
11245
|
+
* @memberof Rect
|
|
11247
11246
|
* @function
|
|
11248
11247
|
* @param {number} w new width of the rectangle
|
|
11249
11248
|
* @param {number} h new height of the rectangle
|
|
@@ -11258,7 +11257,7 @@
|
|
|
11258
11257
|
/**
|
|
11259
11258
|
* scale the rectangle
|
|
11260
11259
|
* @name scale
|
|
11261
|
-
* @memberof Rect
|
|
11260
|
+
* @memberof Rect
|
|
11262
11261
|
* @function
|
|
11263
11262
|
* @param {number} x a number representing the abscissa of the scaling vector.
|
|
11264
11263
|
* @param {number} [y=x] a number representing the ordinate of the scaling vector.
|
|
@@ -11275,7 +11274,7 @@
|
|
|
11275
11274
|
/**
|
|
11276
11275
|
* clone this rectangle
|
|
11277
11276
|
* @name clone
|
|
11278
|
-
* @memberof Rect
|
|
11277
|
+
* @memberof Rect
|
|
11279
11278
|
* @function
|
|
11280
11279
|
* @returns {Rect} new rectangle
|
|
11281
11280
|
*/
|
|
@@ -11286,7 +11285,7 @@
|
|
|
11286
11285
|
/**
|
|
11287
11286
|
* copy the position and size of the given rectangle into this one
|
|
11288
11287
|
* @name copy
|
|
11289
|
-
* @memberof Rect
|
|
11288
|
+
* @memberof Rect
|
|
11290
11289
|
* @function
|
|
11291
11290
|
* @param {Rect} rect Source rectangle
|
|
11292
11291
|
* @returns {Rect} new rectangle
|
|
@@ -11298,7 +11297,7 @@
|
|
|
11298
11297
|
/**
|
|
11299
11298
|
* merge this rectangle with another one
|
|
11300
11299
|
* @name union
|
|
11301
|
-
* @memberof Rect
|
|
11300
|
+
* @memberof Rect
|
|
11302
11301
|
* @function
|
|
11303
11302
|
* @param {Rect} rect other rectangle to union with
|
|
11304
11303
|
* @returns {Rect} the union(ed) rectangle
|
|
@@ -11320,7 +11319,7 @@
|
|
|
11320
11319
|
/**
|
|
11321
11320
|
* check if this rectangle is intersecting with the specified one
|
|
11322
11321
|
* @name overlaps
|
|
11323
|
-
* @memberof Rect
|
|
11322
|
+
* @memberof Rect
|
|
11324
11323
|
* @function
|
|
11325
11324
|
* @param {Rect} rect
|
|
11326
11325
|
* @returns {boolean} true if overlaps
|
|
@@ -11337,7 +11336,7 @@
|
|
|
11337
11336
|
/**
|
|
11338
11337
|
* Returns true if the rectangle contains the given rectangle
|
|
11339
11338
|
* @name contains
|
|
11340
|
-
* @memberof Rect
|
|
11339
|
+
* @memberof Rect
|
|
11341
11340
|
* @function
|
|
11342
11341
|
* @param {Rect} rect
|
|
11343
11342
|
* @returns {boolean} true if contains
|
|
@@ -11346,7 +11345,7 @@
|
|
|
11346
11345
|
/**
|
|
11347
11346
|
* Returns true if the rectangle contains the given point
|
|
11348
11347
|
* @name contains
|
|
11349
|
-
* @memberof Rect
|
|
11348
|
+
* @memberof Rect
|
|
11350
11349
|
* @function
|
|
11351
11350
|
* @param {number} x x coordinate
|
|
11352
11351
|
* @param {number} y y coordinate
|
|
@@ -11356,7 +11355,7 @@
|
|
|
11356
11355
|
/**
|
|
11357
11356
|
* Returns true if the rectangle contains the given point
|
|
11358
11357
|
* @name contains
|
|
11359
|
-
* @memberof Rect
|
|
11358
|
+
* @memberof Rect
|
|
11360
11359
|
* @function
|
|
11361
11360
|
* @param {Vector2d} point
|
|
11362
11361
|
* @returns {boolean} true if contains
|
|
@@ -11392,7 +11391,7 @@
|
|
|
11392
11391
|
/**
|
|
11393
11392
|
* check if this rectangle is identical to the specified one
|
|
11394
11393
|
* @name equals
|
|
11395
|
-
* @memberof Rect
|
|
11394
|
+
* @memberof Rect
|
|
11396
11395
|
* @function
|
|
11397
11396
|
* @param {Rect} rect
|
|
11398
11397
|
* @returns {boolean} true if equals
|
|
@@ -11409,7 +11408,7 @@
|
|
|
11409
11408
|
/**
|
|
11410
11409
|
* determines whether all coordinates of this rectangle are finite numbers.
|
|
11411
11410
|
* @name isFinite
|
|
11412
|
-
* @memberof Rect
|
|
11411
|
+
* @memberof Rect
|
|
11413
11412
|
* @function
|
|
11414
11413
|
* @returns {boolean} false if all coordinates are positive or negative Infinity or NaN; otherwise, true.
|
|
11415
11414
|
*/
|
|
@@ -11420,7 +11419,7 @@
|
|
|
11420
11419
|
/**
|
|
11421
11420
|
* Returns a polygon whose edges are the same as this box.
|
|
11422
11421
|
* @name toPolygon
|
|
11423
|
-
* @memberof Rect
|
|
11422
|
+
* @memberof Rect
|
|
11424
11423
|
* @function
|
|
11425
11424
|
* @returns {Polygon} a new Polygon that represents this rectangle.
|
|
11426
11425
|
*/
|
|
@@ -11906,7 +11905,7 @@
|
|
|
11906
11905
|
this.onResetEvent(vertices);
|
|
11907
11906
|
};
|
|
11908
11907
|
|
|
11909
|
-
var prototypeAccessors$
|
|
11908
|
+
var prototypeAccessors$2 = { x: { configurable: true },y: { configurable: true },width: { configurable: true },height: { configurable: true },left: { configurable: true },right: { configurable: true },top: { configurable: true },bottom: { configurable: true },centerX: { configurable: true },centerY: { configurable: true },center: { configurable: true } };
|
|
11910
11909
|
|
|
11911
11910
|
/**
|
|
11912
11911
|
* @ignore
|
|
@@ -11959,11 +11958,11 @@
|
|
|
11959
11958
|
* @name x
|
|
11960
11959
|
* @memberof Bounds
|
|
11961
11960
|
*/
|
|
11962
|
-
prototypeAccessors$
|
|
11961
|
+
prototypeAccessors$2.x.get = function () {
|
|
11963
11962
|
return this.min.x;
|
|
11964
11963
|
};
|
|
11965
11964
|
|
|
11966
|
-
prototypeAccessors$
|
|
11965
|
+
prototypeAccessors$2.x.set = function (value) {
|
|
11967
11966
|
var deltaX = this.max.x - this.min.x;
|
|
11968
11967
|
this.min.x = value;
|
|
11969
11968
|
this.max.x = value + deltaX;
|
|
@@ -11976,11 +11975,11 @@
|
|
|
11976
11975
|
* @name y
|
|
11977
11976
|
* @memberof Bounds
|
|
11978
11977
|
*/
|
|
11979
|
-
prototypeAccessors$
|
|
11978
|
+
prototypeAccessors$2.y.get = function () {
|
|
11980
11979
|
return this.min.y;
|
|
11981
11980
|
};
|
|
11982
11981
|
|
|
11983
|
-
prototypeAccessors$
|
|
11982
|
+
prototypeAccessors$2.y.set = function (value) {
|
|
11984
11983
|
var deltaY = this.max.y - this.min.y;
|
|
11985
11984
|
|
|
11986
11985
|
this.min.y = value;
|
|
@@ -11994,11 +11993,11 @@
|
|
|
11994
11993
|
* @name width
|
|
11995
11994
|
* @memberof Bounds
|
|
11996
11995
|
*/
|
|
11997
|
-
prototypeAccessors$
|
|
11996
|
+
prototypeAccessors$2.width.get = function () {
|
|
11998
11997
|
return this.max.x - this.min.x;
|
|
11999
11998
|
};
|
|
12000
11999
|
|
|
12001
|
-
prototypeAccessors$
|
|
12000
|
+
prototypeAccessors$2.width.set = function (value) {
|
|
12002
12001
|
this.max.x = this.min.x + value;
|
|
12003
12002
|
};
|
|
12004
12003
|
|
|
@@ -12009,11 +12008,11 @@
|
|
|
12009
12008
|
* @name width
|
|
12010
12009
|
* @memberof Bounds
|
|
12011
12010
|
*/
|
|
12012
|
-
prototypeAccessors$
|
|
12011
|
+
prototypeAccessors$2.height.get = function () {
|
|
12013
12012
|
return this.max.y - this.min.y;
|
|
12014
12013
|
};
|
|
12015
12014
|
|
|
12016
|
-
prototypeAccessors$
|
|
12015
|
+
prototypeAccessors$2.height.set = function (value) {
|
|
12017
12016
|
this.max.y = this.min.y + value;
|
|
12018
12017
|
};
|
|
12019
12018
|
|
|
@@ -12024,7 +12023,7 @@
|
|
|
12024
12023
|
* @name left
|
|
12025
12024
|
* @memberof Bounds
|
|
12026
12025
|
*/
|
|
12027
|
-
prototypeAccessors$
|
|
12026
|
+
prototypeAccessors$2.left.get = function () {
|
|
12028
12027
|
return this.min.x;
|
|
12029
12028
|
};
|
|
12030
12029
|
|
|
@@ -12035,7 +12034,7 @@
|
|
|
12035
12034
|
* @name right
|
|
12036
12035
|
* @memberof Bounds
|
|
12037
12036
|
*/
|
|
12038
|
-
prototypeAccessors$
|
|
12037
|
+
prototypeAccessors$2.right.get = function () {
|
|
12039
12038
|
return this.max.x;
|
|
12040
12039
|
};
|
|
12041
12040
|
|
|
@@ -12046,7 +12045,7 @@
|
|
|
12046
12045
|
* @name top
|
|
12047
12046
|
* @memberof Bounds
|
|
12048
12047
|
*/
|
|
12049
|
-
prototypeAccessors$
|
|
12048
|
+
prototypeAccessors$2.top.get = function () {
|
|
12050
12049
|
return this.min.y;
|
|
12051
12050
|
};
|
|
12052
12051
|
|
|
@@ -12057,7 +12056,7 @@
|
|
|
12057
12056
|
* @name bottom
|
|
12058
12057
|
* @memberof Bounds
|
|
12059
12058
|
*/
|
|
12060
|
-
prototypeAccessors$
|
|
12059
|
+
prototypeAccessors$2.bottom.get = function () {
|
|
12061
12060
|
return this.max.y;
|
|
12062
12061
|
};
|
|
12063
12062
|
|
|
@@ -12068,7 +12067,7 @@
|
|
|
12068
12067
|
* @name centerX
|
|
12069
12068
|
* @memberof Bounds
|
|
12070
12069
|
*/
|
|
12071
|
-
prototypeAccessors$
|
|
12070
|
+
prototypeAccessors$2.centerX.get = function () {
|
|
12072
12071
|
return this.min.x + (this.width / 2);
|
|
12073
12072
|
};
|
|
12074
12073
|
|
|
@@ -12079,7 +12078,7 @@
|
|
|
12079
12078
|
* @name centerY
|
|
12080
12079
|
* @memberof Bounds
|
|
12081
12080
|
*/
|
|
12082
|
-
prototypeAccessors$
|
|
12081
|
+
prototypeAccessors$2.centerY.get = function () {
|
|
12083
12082
|
return this.min.y + (this.height / 2);
|
|
12084
12083
|
};
|
|
12085
12084
|
|
|
@@ -12090,7 +12089,7 @@
|
|
|
12090
12089
|
* @name center
|
|
12091
12090
|
* @memberof Bounds
|
|
12092
12091
|
*/
|
|
12093
|
-
prototypeAccessors$
|
|
12092
|
+
prototypeAccessors$2.center.get = function () {
|
|
12094
12093
|
return this._center.set(this.centerX, this.centerY);
|
|
12095
12094
|
};
|
|
12096
12095
|
|
|
@@ -12354,7 +12353,7 @@
|
|
|
12354
12353
|
]);
|
|
12355
12354
|
};
|
|
12356
12355
|
|
|
12357
|
-
Object.defineProperties( Bounds$1.prototype, prototypeAccessors$
|
|
12356
|
+
Object.defineProperties( Bounds$1.prototype, prototypeAccessors$2 );
|
|
12358
12357
|
|
|
12359
12358
|
/**
|
|
12360
12359
|
* a temporary vector object
|
|
@@ -12852,7 +12851,7 @@
|
|
|
12852
12851
|
if (!pointerInitialized) {
|
|
12853
12852
|
|
|
12854
12853
|
// the current pointer area
|
|
12855
|
-
currentPointer = new Rect(0, 0, 1, 1);
|
|
12854
|
+
currentPointer = new Rect$1(0, 0, 1, 1);
|
|
12856
12855
|
|
|
12857
12856
|
// instantiate a pool of pointer catched
|
|
12858
12857
|
for (var v = 0; v < device$1.maxTouchPoints; v++) {
|
|
@@ -14464,7 +14463,7 @@
|
|
|
14464
14463
|
/**
|
|
14465
14464
|
* returns the bounding box for this renderable
|
|
14466
14465
|
* @name getBounds
|
|
14467
|
-
* @memberof Renderable
|
|
14466
|
+
* @memberof Renderable
|
|
14468
14467
|
* @function
|
|
14469
14468
|
* @returns {Bounds} bounding box Rectangle object
|
|
14470
14469
|
*/
|
|
@@ -14485,7 +14484,7 @@
|
|
|
14485
14484
|
/**
|
|
14486
14485
|
* get the renderable alpha channel value<br>
|
|
14487
14486
|
* @name getOpacity
|
|
14488
|
-
* @memberof Renderable
|
|
14487
|
+
* @memberof Renderable
|
|
14489
14488
|
* @function
|
|
14490
14489
|
* @returns {number} current opacity value between 0 and 1
|
|
14491
14490
|
*/
|
|
@@ -14496,7 +14495,7 @@
|
|
|
14496
14495
|
/**
|
|
14497
14496
|
* set the renderable alpha channel value<br>
|
|
14498
14497
|
* @name setOpacity
|
|
14499
|
-
* @memberof Renderable
|
|
14498
|
+
* @memberof Renderable
|
|
14500
14499
|
* @function
|
|
14501
14500
|
* @param {number} alpha opacity value between 0.0 and 1.0
|
|
14502
14501
|
*/
|
|
@@ -14515,7 +14514,7 @@
|
|
|
14515
14514
|
* flip the renderable on the horizontal axis (around the center of the renderable)
|
|
14516
14515
|
* @see Matrix2d#scaleX
|
|
14517
14516
|
* @name flipX
|
|
14518
|
-
* @memberof Renderable
|
|
14517
|
+
* @memberof Renderable
|
|
14519
14518
|
* @function
|
|
14520
14519
|
* @param {boolean} [flip=true] `true` to flip this renderable.
|
|
14521
14520
|
* @returns {Renderable} Reference to this object for method chaining
|
|
@@ -14532,7 +14531,7 @@
|
|
|
14532
14531
|
* flip the renderable on the vertical axis (around the center of the renderable)
|
|
14533
14532
|
* @see Matrix2d#scaleY
|
|
14534
14533
|
* @name flipY
|
|
14535
|
-
* @memberof Renderable
|
|
14534
|
+
* @memberof Renderable
|
|
14536
14535
|
* @function
|
|
14537
14536
|
* @param {boolean} [flip=true] `true` to flip this renderable.
|
|
14538
14537
|
* @returns {Renderable} Reference to this object for method chaining
|
|
@@ -14548,7 +14547,7 @@
|
|
|
14548
14547
|
/**
|
|
14549
14548
|
* multiply the renderable currentTransform with the given matrix
|
|
14550
14549
|
* @name transform
|
|
14551
|
-
* @memberof Renderable
|
|
14550
|
+
* @memberof Renderable
|
|
14552
14551
|
* @see Renderable#currentTransform
|
|
14553
14552
|
* @function
|
|
14554
14553
|
* @param {Matrix2d} m the transformation matrix
|
|
@@ -14613,7 +14612,7 @@
|
|
|
14613
14612
|
/**
|
|
14614
14613
|
* Rotate this renderable towards the given target.
|
|
14615
14614
|
* @name lookAt
|
|
14616
|
-
* @memberof Renderable
|
|
14615
|
+
* @memberof Renderable
|
|
14617
14616
|
* @function
|
|
14618
14617
|
* @param {Renderable|Vector2d|Vector3d} target the renderable or position to look at
|
|
14619
14618
|
* @returns {Renderable} Reference to this object for method chaining
|
|
@@ -14637,7 +14636,7 @@
|
|
|
14637
14636
|
/**
|
|
14638
14637
|
* Rotate this renderable by the specified angle (in radians).
|
|
14639
14638
|
* @name rotate
|
|
14640
|
-
* @memberof Renderable
|
|
14639
|
+
* @memberof Renderable
|
|
14641
14640
|
* @function
|
|
14642
14641
|
* @param {number} angle The angle to rotate (in radians)
|
|
14643
14642
|
* @param {Vector2d|ObservableVector2d} [v] an optional point to rotate around
|
|
@@ -14659,7 +14658,7 @@
|
|
|
14659
14658
|
* is an image, the image.width and image.height properties are unaltered but the currentTransform
|
|
14660
14659
|
* member will be changed.
|
|
14661
14660
|
* @name scale
|
|
14662
|
-
* @memberof Renderable
|
|
14661
|
+
* @memberof Renderable
|
|
14663
14662
|
* @function
|
|
14664
14663
|
* @param {number} x a number representing the abscissa of the scaling vector.
|
|
14665
14664
|
* @param {number} [y=x] a number representing the ordinate of the scaling vector.
|
|
@@ -14675,7 +14674,7 @@
|
|
|
14675
14674
|
/**
|
|
14676
14675
|
* scale the renderable around his anchor point
|
|
14677
14676
|
* @name scaleV
|
|
14678
|
-
* @memberof Renderable
|
|
14677
|
+
* @memberof Renderable
|
|
14679
14678
|
* @function
|
|
14680
14679
|
* @param {Vector2d} v scaling vector
|
|
14681
14680
|
* @returns {Renderable} Reference to this object for method chaining
|
|
@@ -14689,7 +14688,7 @@
|
|
|
14689
14688
|
* update function. <br>
|
|
14690
14689
|
* automatically called by the game manager {@link game}
|
|
14691
14690
|
* @name update
|
|
14692
|
-
* @memberof Renderable
|
|
14691
|
+
* @memberof Renderable
|
|
14693
14692
|
* @function
|
|
14694
14693
|
* @protected
|
|
14695
14694
|
* @param {number} dt time since the last update in milliseconds.
|
|
@@ -14703,7 +14702,7 @@
|
|
|
14703
14702
|
* update the bounding box for this shape.
|
|
14704
14703
|
* @ignore
|
|
14705
14704
|
* @name updateBounds
|
|
14706
|
-
* @memberof Renderable
|
|
14705
|
+
* @memberof Renderable
|
|
14707
14706
|
* @function
|
|
14708
14707
|
* @returns {Bounds} this shape bounding box Rectangle object
|
|
14709
14708
|
*/
|
|
@@ -14717,7 +14716,7 @@
|
|
|
14717
14716
|
* update the renderable's bounding rect (private)
|
|
14718
14717
|
* @ignore
|
|
14719
14718
|
* @name updateBoundsPos
|
|
14720
|
-
* @memberof Renderable
|
|
14719
|
+
* @memberof Renderable
|
|
14721
14720
|
* @function
|
|
14722
14721
|
*/
|
|
14723
14722
|
Renderable.prototype.updateBoundsPos = function updateBoundsPos (newX, newY) {
|
|
@@ -14743,13 +14742,14 @@
|
|
|
14743
14742
|
if (this.ancestor instanceof Container && this.floating !== true) {
|
|
14744
14743
|
bounds.translate(this.ancestor.getAbsolutePosition());
|
|
14745
14744
|
}
|
|
14746
|
-
|
|
14745
|
+
|
|
14746
|
+
this.isDirty = true;
|
|
14747
14747
|
};
|
|
14748
14748
|
|
|
14749
14749
|
/**
|
|
14750
14750
|
* return the renderable absolute position in the game world
|
|
14751
14751
|
* @name getAbsolutePosition
|
|
14752
|
-
* @memberof Renderable
|
|
14752
|
+
* @memberof Renderable
|
|
14753
14753
|
* @function
|
|
14754
14754
|
* @returns {Vector2d}
|
|
14755
14755
|
*/
|
|
@@ -14769,7 +14769,7 @@
|
|
|
14769
14769
|
* called when the anchor point value is changed
|
|
14770
14770
|
* @private
|
|
14771
14771
|
* @name onAnchorUpdate
|
|
14772
|
-
* @memberof Renderable
|
|
14772
|
+
* @memberof Renderable
|
|
14773
14773
|
* @function
|
|
14774
14774
|
* @param {number} x the new X value to be set for the anchor
|
|
14775
14775
|
* @param {number} y the new Y value to be set for the anchor
|
|
@@ -14787,7 +14787,7 @@
|
|
|
14787
14787
|
* (apply defined transforms, anchor point). <br>
|
|
14788
14788
|
* automatically called by the game manager {@link game}
|
|
14789
14789
|
* @name preDraw
|
|
14790
|
-
* @memberof Renderable
|
|
14790
|
+
* @memberof Renderable
|
|
14791
14791
|
* @function
|
|
14792
14792
|
* @protected
|
|
14793
14793
|
* @param {CanvasRenderer|WebGLRenderer} renderer a renderer object
|
|
@@ -14843,7 +14843,7 @@
|
|
|
14843
14843
|
* object draw. <br>
|
|
14844
14844
|
* automatically called by the game manager {@link game}
|
|
14845
14845
|
* @name draw
|
|
14846
|
-
* @memberof Renderable
|
|
14846
|
+
* @memberof Renderable
|
|
14847
14847
|
* @function
|
|
14848
14848
|
* @protected
|
|
14849
14849
|
* @param {CanvasRenderer|WebGLRenderer} renderer a renderer object
|
|
@@ -14856,7 +14856,7 @@
|
|
|
14856
14856
|
* restore the rendering context after drawing. <br>
|
|
14857
14857
|
* automatically called by the game manager {@link game}
|
|
14858
14858
|
* @name postDraw
|
|
14859
|
-
* @memberof Renderable
|
|
14859
|
+
* @memberof Renderable
|
|
14860
14860
|
* @function
|
|
14861
14861
|
* @protected
|
|
14862
14862
|
* @param {CanvasRenderer|WebGLRenderer} renderer a renderer object
|
|
@@ -14881,7 +14881,7 @@
|
|
|
14881
14881
|
* onCollision callback, triggered in case of collision,
|
|
14882
14882
|
* when this renderable body is colliding with another one
|
|
14883
14883
|
* @name onCollision
|
|
14884
|
-
* @memberof Renderable
|
|
14884
|
+
* @memberof Renderable
|
|
14885
14885
|
* @function
|
|
14886
14886
|
* @param {collision.ResponseObject} response the collision response object
|
|
14887
14887
|
* @param {Renderable} other the other renderable touching this one (a reference to response.a or response.b)
|
|
@@ -14968,7 +14968,7 @@
|
|
|
14968
14968
|
Object.defineProperties( Renderable.prototype, prototypeAccessors );
|
|
14969
14969
|
|
|
14970
14970
|
return Renderable;
|
|
14971
|
-
}(Rect));
|
|
14971
|
+
}(Rect$1));
|
|
14972
14972
|
|
|
14973
14973
|
/**
|
|
14974
14974
|
* @classdesc
|
|
@@ -14980,7 +14980,7 @@
|
|
|
14980
14980
|
* @public
|
|
14981
14981
|
* @type {Vector2d}
|
|
14982
14982
|
* @name pos
|
|
14983
|
-
* @memberof Ellipse
|
|
14983
|
+
* @memberof Ellipse
|
|
14984
14984
|
*/
|
|
14985
14985
|
this.pos = pool$1.pull("Vector2d");
|
|
14986
14986
|
|
|
@@ -14995,7 +14995,7 @@
|
|
|
14995
14995
|
* @public
|
|
14996
14996
|
* @type {number}
|
|
14997
14997
|
* @name radius
|
|
14998
|
-
* @memberof Ellipse
|
|
14998
|
+
* @memberof Ellipse
|
|
14999
14999
|
*/
|
|
15000
15000
|
this.radius = NaN;
|
|
15001
15001
|
|
|
@@ -15004,7 +15004,7 @@
|
|
|
15004
15004
|
* @public
|
|
15005
15005
|
* @type {Vector2d}
|
|
15006
15006
|
* @name radiusV
|
|
15007
|
-
* @memberof Ellipse
|
|
15007
|
+
* @memberof Ellipse
|
|
15008
15008
|
*/
|
|
15009
15009
|
this.radiusV = pool$1.pull("Vector2d");
|
|
15010
15010
|
|
|
@@ -15013,7 +15013,7 @@
|
|
|
15013
15013
|
* @public
|
|
15014
15014
|
* @type {Vector2d}
|
|
15015
15015
|
* @name radiusSq
|
|
15016
|
-
* @memberof Ellipse
|
|
15016
|
+
* @memberof Ellipse
|
|
15017
15017
|
*/
|
|
15018
15018
|
this.radiusSq = pool$1.pull("Vector2d");
|
|
15019
15019
|
|
|
@@ -15022,7 +15022,7 @@
|
|
|
15022
15022
|
* @public
|
|
15023
15023
|
* @type {Vector2d}
|
|
15024
15024
|
* @name ratio
|
|
15025
|
-
* @memberof Ellipse
|
|
15025
|
+
* @memberof Ellipse
|
|
15026
15026
|
*/
|
|
15027
15027
|
this.ratio = pool$1.pull("Vector2d");
|
|
15028
15028
|
|
|
@@ -15039,7 +15039,7 @@
|
|
|
15039
15039
|
/**
|
|
15040
15040
|
* set new value to the Ellipse shape
|
|
15041
15041
|
* @name setShape
|
|
15042
|
-
* @memberof Ellipse
|
|
15042
|
+
* @memberof Ellipse
|
|
15043
15043
|
* @function
|
|
15044
15044
|
* @param {number} x the center x coordinate of the ellipse
|
|
15045
15045
|
* @param {number} y the center y coordinate of the ellipse
|
|
@@ -15069,7 +15069,7 @@
|
|
|
15069
15069
|
/**
|
|
15070
15070
|
* Rotate this Ellipse (counter-clockwise) by the specified angle (in radians).
|
|
15071
15071
|
* @name rotate
|
|
15072
|
-
* @memberof Ellipse
|
|
15072
|
+
* @memberof Ellipse
|
|
15073
15073
|
* @function
|
|
15074
15074
|
* @param {number} angle The angle to rotate (in radians)
|
|
15075
15075
|
* @param {Vector2d|ObservableVector2d} [v] an optional point to rotate around
|
|
@@ -15086,7 +15086,7 @@
|
|
|
15086
15086
|
/**
|
|
15087
15087
|
* Scale this Ellipse by the specified scalar.
|
|
15088
15088
|
* @name scale
|
|
15089
|
-
* @memberof Ellipse
|
|
15089
|
+
* @memberof Ellipse
|
|
15090
15090
|
* @function
|
|
15091
15091
|
* @param {number} x
|
|
15092
15092
|
* @param {number} [y=x]
|
|
@@ -15105,7 +15105,7 @@
|
|
|
15105
15105
|
/**
|
|
15106
15106
|
* Scale this Ellipse by the specified vector.
|
|
15107
15107
|
* @name scale
|
|
15108
|
-
* @memberof Ellipse
|
|
15108
|
+
* @memberof Ellipse
|
|
15109
15109
|
* @function
|
|
15110
15110
|
* @param {Vector2d} v
|
|
15111
15111
|
* @returns {Ellipse} Reference to this object for method chaining
|
|
@@ -15117,7 +15117,7 @@
|
|
|
15117
15117
|
/**
|
|
15118
15118
|
* apply the given transformation matrix to this ellipse
|
|
15119
15119
|
* @name transform
|
|
15120
|
-
* @memberof Ellipse
|
|
15120
|
+
* @memberof Ellipse
|
|
15121
15121
|
* @function
|
|
15122
15122
|
* @param {Matrix2d} matrix the transformation matrix
|
|
15123
15123
|
* @returns {Polygon} Reference to this object for method chaining
|
|
@@ -15130,7 +15130,7 @@
|
|
|
15130
15130
|
/**
|
|
15131
15131
|
* translate the circle/ellipse by the specified offset
|
|
15132
15132
|
* @name translate
|
|
15133
|
-
* @memberof Ellipse
|
|
15133
|
+
* @memberof Ellipse
|
|
15134
15134
|
* @function
|
|
15135
15135
|
* @param {number} x x offset
|
|
15136
15136
|
* @param {number} y y offset
|
|
@@ -15139,7 +15139,7 @@
|
|
|
15139
15139
|
/**
|
|
15140
15140
|
* translate the circle/ellipse by the specified vector
|
|
15141
15141
|
* @name translate
|
|
15142
|
-
* @memberof Ellipse
|
|
15142
|
+
* @memberof Ellipse
|
|
15143
15143
|
* @function
|
|
15144
15144
|
* @param {Vector2d} v vector offset
|
|
15145
15145
|
* @returns {Ellipse} this ellipse
|
|
@@ -15167,7 +15167,7 @@
|
|
|
15167
15167
|
/**
|
|
15168
15168
|
* check if this circle/ellipse contains the specified point
|
|
15169
15169
|
* @name contains
|
|
15170
|
-
* @memberof Ellipse
|
|
15170
|
+
* @memberof Ellipse
|
|
15171
15171
|
* @function
|
|
15172
15172
|
* @param {Vector2d} point
|
|
15173
15173
|
* @returns {boolean} true if contains
|
|
@@ -15176,7 +15176,7 @@
|
|
|
15176
15176
|
/**
|
|
15177
15177
|
* check if this circle/ellipse contains the specified point
|
|
15178
15178
|
* @name contains
|
|
15179
|
-
* @memberof Ellipse
|
|
15179
|
+
* @memberof Ellipse
|
|
15180
15180
|
* @function
|
|
15181
15181
|
* @param {number} x x coordinate
|
|
15182
15182
|
* @param {number} y y coordinate
|
|
@@ -15208,7 +15208,7 @@
|
|
|
15208
15208
|
/**
|
|
15209
15209
|
* returns the bounding box for this shape, the smallest Rectangle object completely containing this shape.
|
|
15210
15210
|
* @name getBounds
|
|
15211
|
-
* @memberof Ellipse
|
|
15211
|
+
* @memberof Ellipse
|
|
15212
15212
|
* @function
|
|
15213
15213
|
* @returns {Bounds} this shape bounding box Rectangle object
|
|
15214
15214
|
*/
|
|
@@ -15222,7 +15222,7 @@
|
|
|
15222
15222
|
/**
|
|
15223
15223
|
* clone this Ellipse
|
|
15224
15224
|
* @name clone
|
|
15225
|
-
* @memberof Ellipse
|
|
15225
|
+
* @memberof Ellipse
|
|
15226
15226
|
* @function
|
|
15227
15227
|
* @returns {Ellipse} new Ellipse
|
|
15228
15228
|
*/
|
|
@@ -16311,7 +16311,7 @@
|
|
|
16311
16311
|
* this.body.addShape(me.loader.getJSON("shapesdef").banana);
|
|
16312
16312
|
*/
|
|
16313
16313
|
Body.prototype.addShape = function addShape (shape) {
|
|
16314
|
-
if (shape instanceof Rect || shape instanceof Bounds$1) {
|
|
16314
|
+
if (shape instanceof Rect$1 || shape instanceof Bounds$1) {
|
|
16315
16315
|
var poly = shape.toPolygon();
|
|
16316
16316
|
this.shapes.push(poly);
|
|
16317
16317
|
// update the body bounds
|
|
@@ -16799,7 +16799,7 @@
|
|
|
16799
16799
|
|
|
16800
16800
|
/**
|
|
16801
16801
|
* @classdesc
|
|
16802
|
-
*
|
|
16802
|
+
* Container represents a collection of child objects
|
|
16803
16803
|
* @augments Renderable
|
|
16804
16804
|
*/
|
|
16805
16805
|
var Container = /*@__PURE__*/(function (Renderable) {
|
|
@@ -16976,7 +16976,7 @@
|
|
|
16976
16976
|
* orginal container. Then when the me.game.world.reset() is called the renderable
|
|
16977
16977
|
* will not be in any container.
|
|
16978
16978
|
* @name addChild
|
|
16979
|
-
* @memberof Container
|
|
16979
|
+
* @memberof Container
|
|
16980
16980
|
* @function
|
|
16981
16981
|
* @param {Renderable} child
|
|
16982
16982
|
* @param {number} [z] forces the z index of the child to the specified value
|
|
@@ -17040,7 +17040,7 @@
|
|
|
17040
17040
|
* Add a child to the container at the specified index<br>
|
|
17041
17041
|
* (the list won't be sorted after insertion)
|
|
17042
17042
|
* @name addChildAt
|
|
17043
|
-
* @memberof Container
|
|
17043
|
+
* @memberof Container
|
|
17044
17044
|
* @function
|
|
17045
17045
|
* @param {Renderable} child
|
|
17046
17046
|
* @param {number} index
|
|
@@ -17099,7 +17099,7 @@
|
|
|
17099
17099
|
* - The index of element in the array. <br>
|
|
17100
17100
|
* - The array forEach() was called upon. <br>
|
|
17101
17101
|
* @name forEach
|
|
17102
|
-
* @memberof Container
|
|
17102
|
+
* @memberof Container
|
|
17103
17103
|
* @function
|
|
17104
17104
|
* @param {Function} callback fnction to execute on each element
|
|
17105
17105
|
* @param {object} [thisArg] value to use as this(i.e reference Object) when executing callback.
|
|
@@ -17136,7 +17136,7 @@
|
|
|
17136
17136
|
/**
|
|
17137
17137
|
* Swaps the position (z-index) of 2 children
|
|
17138
17138
|
* @name swapChildren
|
|
17139
|
-
* @memberof Container
|
|
17139
|
+
* @memberof Container
|
|
17140
17140
|
* @function
|
|
17141
17141
|
* @param {Renderable} child
|
|
17142
17142
|
* @param {Renderable} child2
|
|
@@ -17164,7 +17164,7 @@
|
|
|
17164
17164
|
/**
|
|
17165
17165
|
* Returns the Child at the specified index
|
|
17166
17166
|
* @name getChildAt
|
|
17167
|
-
* @memberof Container
|
|
17167
|
+
* @memberof Container
|
|
17168
17168
|
* @function
|
|
17169
17169
|
* @param {number} index
|
|
17170
17170
|
* @returns {Renderable} the child at the specified index
|
|
@@ -17181,7 +17181,7 @@
|
|
|
17181
17181
|
/**
|
|
17182
17182
|
* Returns the index of the given Child
|
|
17183
17183
|
* @name getChildIndex
|
|
17184
|
-
* @memberof Container
|
|
17184
|
+
* @memberof Container
|
|
17185
17185
|
* @function
|
|
17186
17186
|
* @param {Renderable} child
|
|
17187
17187
|
* @returns {number} index
|
|
@@ -17209,7 +17209,7 @@
|
|
|
17209
17209
|
/**
|
|
17210
17210
|
* Returns true if contains the specified Child
|
|
17211
17211
|
* @name hasChild
|
|
17212
|
-
* @memberof Container
|
|
17212
|
+
* @memberof Container
|
|
17213
17213
|
* @function
|
|
17214
17214
|
* @param {Renderable} child
|
|
17215
17215
|
* @returns {boolean}
|
|
@@ -17223,7 +17223,7 @@
|
|
|
17223
17223
|
* note : avoid calling this function every frame since
|
|
17224
17224
|
* it parses the whole object tree each time
|
|
17225
17225
|
* @name getChildByProp
|
|
17226
|
-
* @memberof Container
|
|
17226
|
+
* @memberof Container
|
|
17227
17227
|
* @public
|
|
17228
17228
|
* @function
|
|
17229
17229
|
* @param {string} prop Property name
|
|
@@ -17275,7 +17275,7 @@
|
|
|
17275
17275
|
/**
|
|
17276
17276
|
* returns the list of childs with the specified class type
|
|
17277
17277
|
* @name getChildByType
|
|
17278
|
-
* @memberof Container
|
|
17278
|
+
* @memberof Container
|
|
17279
17279
|
* @public
|
|
17280
17280
|
* @function
|
|
17281
17281
|
* @param {object} classType
|
|
@@ -17302,7 +17302,7 @@
|
|
|
17302
17302
|
* note : avoid calling this function every frame since
|
|
17303
17303
|
* it parses the whole object list each time
|
|
17304
17304
|
* @name getChildByName
|
|
17305
|
-
* @memberof Container
|
|
17305
|
+
* @memberof Container
|
|
17306
17306
|
* @public
|
|
17307
17307
|
* @function
|
|
17308
17308
|
* @param {string|RegExp|number|boolean} name child name
|
|
@@ -17317,7 +17317,7 @@
|
|
|
17317
17317
|
* note : avoid calling this function every frame since
|
|
17318
17318
|
* it parses the whole object list each time
|
|
17319
17319
|
* @name getChildByGUID
|
|
17320
|
-
* @memberof Container
|
|
17320
|
+
* @memberof Container
|
|
17321
17321
|
* @public
|
|
17322
17322
|
* @function
|
|
17323
17323
|
* @param {string|RegExp|number|boolean} guid child GUID
|
|
@@ -17331,7 +17331,7 @@
|
|
|
17331
17331
|
/**
|
|
17332
17332
|
* return all child in this container
|
|
17333
17333
|
* @name getChildren
|
|
17334
|
-
* @memberof Container
|
|
17334
|
+
* @memberof Container
|
|
17335
17335
|
* @public
|
|
17336
17336
|
* @function
|
|
17337
17337
|
* @returns {Renderable[]} an array of renderable object
|
|
@@ -17347,7 +17347,7 @@
|
|
|
17347
17347
|
* update the bounding box for this shape.
|
|
17348
17348
|
* @ignore
|
|
17349
17349
|
* @name updateBounds
|
|
17350
|
-
* @memberof Renderable
|
|
17350
|
+
* @memberof Renderable
|
|
17351
17351
|
* @function
|
|
17352
17352
|
* @returns {Bounds} this shape bounding box Rectangle object
|
|
17353
17353
|
*/
|
|
@@ -17378,7 +17378,7 @@
|
|
|
17378
17378
|
* Checks if this container is root or if it's attached to the root container.
|
|
17379
17379
|
* @private
|
|
17380
17380
|
* @name isAttachedToRoot
|
|
17381
|
-
* @memberof Container
|
|
17381
|
+
* @memberof Container
|
|
17382
17382
|
* @function
|
|
17383
17383
|
* @returns {boolean}
|
|
17384
17384
|
*/
|
|
@@ -17401,7 +17401,7 @@
|
|
|
17401
17401
|
* update the cointainer's bounding rect (private)
|
|
17402
17402
|
* @ignore
|
|
17403
17403
|
* @name updateBoundsPos
|
|
17404
|
-
* @memberof Container
|
|
17404
|
+
* @memberof Container
|
|
17405
17405
|
* @function
|
|
17406
17406
|
*/
|
|
17407
17407
|
Container.prototype.updateBoundsPos = function updateBoundsPos (newX, newY) {
|
|
@@ -17438,7 +17438,7 @@
|
|
|
17438
17438
|
/**
|
|
17439
17439
|
* Invokes the removeChildNow in a defer, to ensure the child is removed safely after the update & draw stack has completed
|
|
17440
17440
|
* @name removeChild
|
|
17441
|
-
* @memberof Container
|
|
17441
|
+
* @memberof Container
|
|
17442
17442
|
* @public
|
|
17443
17443
|
* @function
|
|
17444
17444
|
* @param {Renderable} child
|
|
@@ -17458,7 +17458,7 @@
|
|
|
17458
17458
|
* (removal is immediate and unconditional)<br>
|
|
17459
17459
|
* Never use keepalive=true with objects from {@link pool}. Doing so will create a memory leak.
|
|
17460
17460
|
* @name removeChildNow
|
|
17461
|
-
* @memberof Container
|
|
17461
|
+
* @memberof Container
|
|
17462
17462
|
* @function
|
|
17463
17463
|
* @param {Renderable} child
|
|
17464
17464
|
* @param {boolean} [keepalive=False] True to prevent calling child.destroy()
|
|
@@ -17511,7 +17511,7 @@
|
|
|
17511
17511
|
/**
|
|
17512
17512
|
* Automatically set the specified property of all childs to the given value
|
|
17513
17513
|
* @name setChildsProperty
|
|
17514
|
-
* @memberof Container
|
|
17514
|
+
* @memberof Container
|
|
17515
17515
|
* @function
|
|
17516
17516
|
* @param {string} prop property name
|
|
17517
17517
|
* @param {object} value property value
|
|
@@ -17529,7 +17529,7 @@
|
|
|
17529
17529
|
/**
|
|
17530
17530
|
* Move the child in the group one step forward (z depth).
|
|
17531
17531
|
* @name moveUp
|
|
17532
|
-
* @memberof Container
|
|
17532
|
+
* @memberof Container
|
|
17533
17533
|
* @function
|
|
17534
17534
|
* @param {Renderable} child
|
|
17535
17535
|
*/
|
|
@@ -17546,7 +17546,7 @@
|
|
|
17546
17546
|
/**
|
|
17547
17547
|
* Move the child in the group one step backward (z depth).
|
|
17548
17548
|
* @name moveDown
|
|
17549
|
-
* @memberof Container
|
|
17549
|
+
* @memberof Container
|
|
17550
17550
|
* @function
|
|
17551
17551
|
* @param {Renderable} child
|
|
17552
17552
|
*/
|
|
@@ -17563,7 +17563,7 @@
|
|
|
17563
17563
|
/**
|
|
17564
17564
|
* Move the specified child to the top(z depth).
|
|
17565
17565
|
* @name moveToTop
|
|
17566
|
-
* @memberof Container
|
|
17566
|
+
* @memberof Container
|
|
17567
17567
|
* @function
|
|
17568
17568
|
* @param {Renderable} child
|
|
17569
17569
|
*/
|
|
@@ -17583,7 +17583,7 @@
|
|
|
17583
17583
|
/**
|
|
17584
17584
|
* Move the specified child the bottom (z depth).
|
|
17585
17585
|
* @name moveToBottom
|
|
17586
|
-
* @memberof Container
|
|
17586
|
+
* @memberof Container
|
|
17587
17587
|
* @function
|
|
17588
17588
|
* @param {Renderable} child
|
|
17589
17589
|
*/
|
|
@@ -17603,7 +17603,7 @@
|
|
|
17603
17603
|
/**
|
|
17604
17604
|
* Manually trigger the sort of all the childs in the container</p>
|
|
17605
17605
|
* @name sort
|
|
17606
|
-
* @memberof Container
|
|
17606
|
+
* @memberof Container
|
|
17607
17607
|
* @public
|
|
17608
17608
|
* @function
|
|
17609
17609
|
* @param {boolean} [recursive=false] recursively sort all containers if true
|
|
@@ -17698,7 +17698,7 @@
|
|
|
17698
17698
|
* container update function. <br>
|
|
17699
17699
|
* automatically called by the game manager {@link game}
|
|
17700
17700
|
* @name update
|
|
17701
|
-
* @memberof Container
|
|
17701
|
+
* @memberof Container
|
|
17702
17702
|
* @function
|
|
17703
17703
|
* @protected
|
|
17704
17704
|
* @param {number} dt time since the last update in milliseconds.
|
|
@@ -17750,7 +17750,7 @@
|
|
|
17750
17750
|
* draw the container. <br>
|
|
17751
17751
|
* automatically called by the game manager {@link game}
|
|
17752
17752
|
* @name draw
|
|
17753
|
-
* @memberof Container
|
|
17753
|
+
* @memberof Container
|
|
17754
17754
|
* @function
|
|
17755
17755
|
* @protected
|
|
17756
17756
|
* @param {CanvasRenderer|WebGLRenderer} renderer a renderer object
|
|
@@ -18360,9 +18360,9 @@
|
|
|
18360
18360
|
}(Container));
|
|
18361
18361
|
|
|
18362
18362
|
/**
|
|
18363
|
-
*
|
|
18363
|
+
* game represents your current game, it contains all the objects,
|
|
18364
18364
|
* tilemap layers, current viewport, collision map, etc...<br>
|
|
18365
|
-
*
|
|
18365
|
+
* game is also responsible for updating (each frame) the object status and draw them.
|
|
18366
18366
|
* @namespace game
|
|
18367
18367
|
*/
|
|
18368
18368
|
|
|
@@ -18840,7 +18840,7 @@
|
|
|
18840
18840
|
*/
|
|
18841
18841
|
Camera2d.prototype.setDeadzone = function setDeadzone (w, h) {
|
|
18842
18842
|
if (typeof(this.deadzone) === "undefined") {
|
|
18843
|
-
this.deadzone = new Rect(0, 0, 0, 0);
|
|
18843
|
+
this.deadzone = new Rect$1(0, 0, 0, 0);
|
|
18844
18844
|
}
|
|
18845
18845
|
|
|
18846
18846
|
// reusing the old code for now...
|
|
@@ -19367,6 +19367,40 @@
|
|
|
19367
19367
|
*/
|
|
19368
19368
|
this.cameras = new Map();
|
|
19369
19369
|
|
|
19370
|
+
/**
|
|
19371
|
+
* The list of active lights in this stage.
|
|
19372
|
+
* (Note: Canvas Renderering mode will only properly support one light per stage)
|
|
19373
|
+
* @public
|
|
19374
|
+
* @type {Map<Light2d>}
|
|
19375
|
+
* @name lights
|
|
19376
|
+
* @memberof Stage
|
|
19377
|
+
* @see Light2d
|
|
19378
|
+
* @see Stage.ambientLight
|
|
19379
|
+
* @example
|
|
19380
|
+
* // create a white spot light
|
|
19381
|
+
* var whiteLight = new me.Light2d(0, 0, 140, "#fff", 0.7);
|
|
19382
|
+
* // and add the light to this current stage
|
|
19383
|
+
* this.lights.set("whiteLight", whiteLight);
|
|
19384
|
+
* // set a dark ambient light
|
|
19385
|
+
* this.ambientLight.parseCSS("#1117");
|
|
19386
|
+
* // make the light follow the mouse
|
|
19387
|
+
* me.input.registerPointerEvent("pointermove", me.game.viewport, (event) => {
|
|
19388
|
+
*whiteLight.centerOn(event.gameX, event.gameY);
|
|
19389
|
+
* });
|
|
19390
|
+
*/
|
|
19391
|
+
this.lights = new Map();
|
|
19392
|
+
|
|
19393
|
+
/**
|
|
19394
|
+
* an ambient light that will be added to the stage rendering
|
|
19395
|
+
* @public
|
|
19396
|
+
* @type {Color}
|
|
19397
|
+
* @name ambientLight
|
|
19398
|
+
* @memberof Stage
|
|
19399
|
+
* @default "#000000"
|
|
19400
|
+
* @see Light2d
|
|
19401
|
+
*/
|
|
19402
|
+
this.ambientLight = new Color(0, 0, 0, 0);
|
|
19403
|
+
|
|
19370
19404
|
/**
|
|
19371
19405
|
* The given constructor options
|
|
19372
19406
|
* @public
|
|
@@ -19424,7 +19458,13 @@
|
|
|
19424
19458
|
// update the camera/viewport
|
|
19425
19459
|
// iterate through all cameras
|
|
19426
19460
|
this.cameras.forEach(function(camera) {
|
|
19427
|
-
if (camera.update(dt)) {
|
|
19461
|
+
if (camera.update(dt) === true) {
|
|
19462
|
+
isDirty = true;
|
|
19463
|
+
} });
|
|
19464
|
+
|
|
19465
|
+
// update all lights
|
|
19466
|
+
this.lights.forEach(function (light) {
|
|
19467
|
+
if (light.update(dt) === true) {
|
|
19428
19468
|
isDirty = true;
|
|
19429
19469
|
} });
|
|
19430
19470
|
|
|
@@ -19440,10 +19480,35 @@
|
|
|
19440
19480
|
* @param {CanvasRenderer|WebGLRenderer} renderer a renderer object
|
|
19441
19481
|
*/
|
|
19442
19482
|
Stage.prototype.draw = function draw (renderer) {
|
|
19483
|
+
var this$1$1 = this;
|
|
19484
|
+
|
|
19443
19485
|
// iterate through all cameras
|
|
19444
|
-
this.cameras.forEach(function(camera) {
|
|
19486
|
+
this.cameras.forEach(function (camera) {
|
|
19445
19487
|
// render the root container
|
|
19446
19488
|
camera.draw(renderer, world);
|
|
19489
|
+
|
|
19490
|
+
// render the ambient light
|
|
19491
|
+
if (this$1$1.ambientLight.alpha !== 0) {
|
|
19492
|
+
renderer.save();
|
|
19493
|
+
// iterate through all lights
|
|
19494
|
+
this$1$1.lights.forEach(function (light) {
|
|
19495
|
+
// cut out all lights visible areas
|
|
19496
|
+
renderer.setMask(light.getVisibleArea(), true);
|
|
19497
|
+
});
|
|
19498
|
+
// fill the screen with the ambient color
|
|
19499
|
+
renderer.setColor(this$1$1.ambientLight);
|
|
19500
|
+
renderer.fillRect(0, 0, camera.width, camera.height);
|
|
19501
|
+
// clear all masks
|
|
19502
|
+
renderer.clearMask();
|
|
19503
|
+
renderer.restore();
|
|
19504
|
+
}
|
|
19505
|
+
|
|
19506
|
+
// render all lights
|
|
19507
|
+
this$1$1.lights.forEach(function (light) {
|
|
19508
|
+
light.preDraw(renderer, world);
|
|
19509
|
+
light.draw(renderer, world);
|
|
19510
|
+
light.postDraw(renderer, world);
|
|
19511
|
+
});
|
|
19447
19512
|
});
|
|
19448
19513
|
};
|
|
19449
19514
|
|
|
@@ -19454,6 +19519,11 @@
|
|
|
19454
19519
|
Stage.prototype.destroy = function destroy () {
|
|
19455
19520
|
// clear all cameras
|
|
19456
19521
|
this.cameras.clear();
|
|
19522
|
+
// clear all lights
|
|
19523
|
+
this.lights.forEach(function (light) {
|
|
19524
|
+
light.destroy();
|
|
19525
|
+
});
|
|
19526
|
+
this.lights.clear();
|
|
19457
19527
|
// notify the object
|
|
19458
19528
|
this.onDestroyEvent.apply(this, arguments);
|
|
19459
19529
|
};
|
|
@@ -19550,13 +19620,13 @@
|
|
|
19550
19620
|
function IconLogo(x, y) {
|
|
19551
19621
|
Renderable.call(this, x, y, 100, 85);
|
|
19552
19622
|
|
|
19553
|
-
this.
|
|
19623
|
+
this.iconTexture = pool$1.pull("CanvasTexture",
|
|
19554
19624
|
renderer.WebGLVersion > 1 ? this.width : nextPowerOfTwo(this.width),
|
|
19555
19625
|
renderer.WebGLVersion > 1 ? this.height : nextPowerOfTwo(this.height),
|
|
19556
|
-
|
|
19626
|
+
true
|
|
19557
19627
|
);
|
|
19558
19628
|
|
|
19559
|
-
var context =
|
|
19629
|
+
var context = this.iconTexture.context;
|
|
19560
19630
|
|
|
19561
19631
|
context.beginPath();
|
|
19562
19632
|
context.moveTo(0.7, 48.9);
|
|
@@ -19595,7 +19665,18 @@
|
|
|
19595
19665
|
* @ignore
|
|
19596
19666
|
*/
|
|
19597
19667
|
IconLogo.prototype.draw = function draw (renderer) {
|
|
19598
|
-
renderer.drawImage(this.
|
|
19668
|
+
renderer.drawImage(this.iconTexture.canvas, renderer.getWidth() / 2, this.pos.y);
|
|
19669
|
+
};
|
|
19670
|
+
|
|
19671
|
+
/**
|
|
19672
|
+
* Destroy function
|
|
19673
|
+
* @ignore
|
|
19674
|
+
*/
|
|
19675
|
+
IconLogo.prototype.destroy = function destroy () {
|
|
19676
|
+
// call the parent destroy method
|
|
19677
|
+
Renderable.prototype.destroy.call(this, arguments);
|
|
19678
|
+
pool$1.push(this.iconTexture);
|
|
19679
|
+
this.iconTexture = undefined;
|
|
19599
19680
|
};
|
|
19600
19681
|
|
|
19601
19682
|
return IconLogo;
|
|
@@ -20280,7 +20361,7 @@
|
|
|
20280
20361
|
match = value.split(/^eval:/i)[1];
|
|
20281
20362
|
try {
|
|
20282
20363
|
// eslint-disable-next-line
|
|
20283
|
-
value =
|
|
20364
|
+
value = Function("'use strict';return (" + match + ")")();
|
|
20284
20365
|
}
|
|
20285
20366
|
catch (e$1) {
|
|
20286
20367
|
throw new Error("Unable to evaluate: " + match);
|
|
@@ -21813,7 +21894,7 @@
|
|
|
21813
21894
|
/**
|
|
21814
21895
|
* return the flickering state of the object
|
|
21815
21896
|
* @name isFlickering
|
|
21816
|
-
* @memberof Sprite
|
|
21897
|
+
* @memberof Sprite
|
|
21817
21898
|
* @function
|
|
21818
21899
|
* @returns {boolean}
|
|
21819
21900
|
*/
|
|
@@ -21824,7 +21905,7 @@
|
|
|
21824
21905
|
/**
|
|
21825
21906
|
* make the object flicker
|
|
21826
21907
|
* @name flicker
|
|
21827
|
-
* @memberof Sprite
|
|
21908
|
+
* @memberof Sprite
|
|
21828
21909
|
* @function
|
|
21829
21910
|
* @param {number} duration expressed in milliseconds
|
|
21830
21911
|
* @param {Function} callback Function to call when flickering ends
|
|
@@ -21855,7 +21936,7 @@
|
|
|
21855
21936
|
* logic as per the following example :<br>
|
|
21856
21937
|
* <img src="images/spritesheet_grid.png"/>
|
|
21857
21938
|
* @name addAnimation
|
|
21858
|
-
* @memberof Sprite
|
|
21939
|
+
* @memberof Sprite
|
|
21859
21940
|
* @function
|
|
21860
21941
|
* @param {string} name animation id
|
|
21861
21942
|
* @param {number[]|string[]|object[]} index list of sprite index or name
|
|
@@ -21955,7 +22036,7 @@
|
|
|
21955
22036
|
* set the current animation
|
|
21956
22037
|
* this will always change the animation & set the frame to zero
|
|
21957
22038
|
* @name setCurrentAnimation
|
|
21958
|
-
* @memberof Sprite
|
|
22039
|
+
* @memberof Sprite
|
|
21959
22040
|
* @function
|
|
21960
22041
|
* @param {string} name animation id
|
|
21961
22042
|
* @param {string|Function} [resetAnim] animation id to switch to when complete, or callback
|
|
@@ -22016,7 +22097,7 @@
|
|
|
22016
22097
|
/**
|
|
22017
22098
|
* reverse the given or current animation if none is specified
|
|
22018
22099
|
* @name reverseAnimation
|
|
22019
|
-
* @memberof Sprite
|
|
22100
|
+
* @memberof Sprite
|
|
22020
22101
|
* @function
|
|
22021
22102
|
* @param {string} [name] animation id
|
|
22022
22103
|
* @returns {Sprite} Reference to this object for method chaining
|
|
@@ -22035,7 +22116,7 @@
|
|
|
22035
22116
|
/**
|
|
22036
22117
|
* return true if the specified animation is the current one.
|
|
22037
22118
|
* @name isCurrentAnimation
|
|
22038
|
-
* @memberof Sprite
|
|
22119
|
+
* @memberof Sprite
|
|
22039
22120
|
* @function
|
|
22040
22121
|
* @param {string} name animation id
|
|
22041
22122
|
* @returns {boolean}
|
|
@@ -22052,7 +22133,7 @@
|
|
|
22052
22133
|
* change the current texture atlas region for this sprite
|
|
22053
22134
|
* @see Texture.getRegion
|
|
22054
22135
|
* @name setRegion
|
|
22055
|
-
* @memberof Sprite
|
|
22136
|
+
* @memberof Sprite
|
|
22056
22137
|
* @function
|
|
22057
22138
|
* @param {object} region typically returned through me.Texture.getRegion()
|
|
22058
22139
|
* @returns {Sprite} Reference to this object for method chaining
|
|
@@ -22084,7 +22165,7 @@
|
|
|
22084
22165
|
/**
|
|
22085
22166
|
* force the current animation frame index.
|
|
22086
22167
|
* @name setAnimationFrame
|
|
22087
|
-
* @memberof Sprite
|
|
22168
|
+
* @memberof Sprite
|
|
22088
22169
|
* @function
|
|
22089
22170
|
* @param {number} [idx=0] animation frame index
|
|
22090
22171
|
* @returns {Sprite} Reference to this object for method chaining
|
|
@@ -22100,7 +22181,7 @@
|
|
|
22100
22181
|
/**
|
|
22101
22182
|
* return the current animation frame index.
|
|
22102
22183
|
* @name getCurrentAnimationFrame
|
|
22103
|
-
* @memberof Sprite
|
|
22184
|
+
* @memberof Sprite
|
|
22104
22185
|
* @function
|
|
22105
22186
|
* @returns {number} current animation frame index
|
|
22106
22187
|
*/
|
|
@@ -22111,7 +22192,7 @@
|
|
|
22111
22192
|
/**
|
|
22112
22193
|
* Returns the frame object by the index.
|
|
22113
22194
|
* @name getAnimationFrameObjectByIndex
|
|
22114
|
-
* @memberof Sprite
|
|
22195
|
+
* @memberof Sprite
|
|
22115
22196
|
* @function
|
|
22116
22197
|
* @ignore
|
|
22117
22198
|
* @param {number} id the frame id
|
|
@@ -22125,7 +22206,7 @@
|
|
|
22125
22206
|
* update function. <br>
|
|
22126
22207
|
* automatically called by the game manager {@link game}
|
|
22127
22208
|
* @name update
|
|
22128
|
-
* @memberof Sprite
|
|
22209
|
+
* @memberof Sprite
|
|
22129
22210
|
* @function
|
|
22130
22211
|
* @protected
|
|
22131
22212
|
* @param {number} dt time since the last update in milliseconds.
|
|
@@ -22204,7 +22285,7 @@
|
|
|
22204
22285
|
* sprite draw. <br>
|
|
22205
22286
|
* automatically called by the game manager {@link game}
|
|
22206
22287
|
* @name draw
|
|
22207
|
-
* @memberof Sprite
|
|
22288
|
+
* @memberof Sprite
|
|
22208
22289
|
* @function
|
|
22209
22290
|
* @protected
|
|
22210
22291
|
* @param {CanvasRenderer|WebGLRenderer} renderer a renderer object
|
|
@@ -22474,7 +22555,7 @@
|
|
|
22474
22555
|
* @type {number}
|
|
22475
22556
|
* @default 20
|
|
22476
22557
|
* @name radius
|
|
22477
|
-
* @memberof RoundRect
|
|
22558
|
+
* @memberof RoundRect
|
|
22478
22559
|
*/
|
|
22479
22560
|
prototypeAccessors.radius.get = function () {
|
|
22480
22561
|
return this._radius;
|
|
@@ -22493,7 +22574,7 @@
|
|
|
22493
22574
|
/**
|
|
22494
22575
|
* copy the position, size and radius of the given rounded rectangle into this one
|
|
22495
22576
|
* @name copy
|
|
22496
|
-
* @memberof RoundRect
|
|
22577
|
+
* @memberof RoundRect
|
|
22497
22578
|
* @function
|
|
22498
22579
|
* @param {RoundRect} rrect source rounded rectangle
|
|
22499
22580
|
* @returns {RoundRect} new rectangle
|
|
@@ -22507,7 +22588,7 @@
|
|
|
22507
22588
|
/**
|
|
22508
22589
|
* Returns true if the rounded rectangle contains the given point
|
|
22509
22590
|
* @name contains
|
|
22510
|
-
* @memberof RoundRect
|
|
22591
|
+
* @memberof RoundRect
|
|
22511
22592
|
* @function
|
|
22512
22593
|
* @param {number} x x coordinate
|
|
22513
22594
|
* @param {number} y y coordinate
|
|
@@ -22517,7 +22598,7 @@
|
|
|
22517
22598
|
/**
|
|
22518
22599
|
* Returns true if the rounded rectangle contains the given point
|
|
22519
22600
|
* @name contains
|
|
22520
|
-
* @memberof RoundRect
|
|
22601
|
+
* @memberof RoundRect
|
|
22521
22602
|
* @function
|
|
22522
22603
|
* @param {Vector2d} point
|
|
22523
22604
|
* @returns {boolean} true if contains
|
|
@@ -22578,7 +22659,7 @@
|
|
|
22578
22659
|
/**
|
|
22579
22660
|
* check if this RoundRect is identical to the specified one
|
|
22580
22661
|
* @name equals
|
|
22581
|
-
* @memberof RoundRect
|
|
22662
|
+
* @memberof RoundRect
|
|
22582
22663
|
* @function
|
|
22583
22664
|
* @param {RoundRect} rrect
|
|
22584
22665
|
* @returns {boolean} true if equals
|
|
@@ -22590,7 +22671,7 @@
|
|
|
22590
22671
|
/**
|
|
22591
22672
|
* clone this RoundRect
|
|
22592
22673
|
* @name clone
|
|
22593
|
-
* @memberof RoundRect
|
|
22674
|
+
* @memberof RoundRect
|
|
22594
22675
|
* @function
|
|
22595
22676
|
* @returns {RoundRect} new RoundRect
|
|
22596
22677
|
*/
|
|
@@ -22601,7 +22682,7 @@
|
|
|
22601
22682
|
Object.defineProperties( RoundRect.prototype, prototypeAccessors );
|
|
22602
22683
|
|
|
22603
22684
|
return RoundRect;
|
|
22604
|
-
}(Rect));
|
|
22685
|
+
}(Rect$1));
|
|
22605
22686
|
|
|
22606
22687
|
/**
|
|
22607
22688
|
* @classdesc
|
|
@@ -22649,7 +22730,7 @@
|
|
|
22649
22730
|
* Computes the calculated collision edges and normals.
|
|
22650
22731
|
* This **must** be called if the `points` array, `angle`, or `offset` is modified manually.
|
|
22651
22732
|
* @name recalc
|
|
22652
|
-
* @memberof Line
|
|
22733
|
+
* @memberof Line
|
|
22653
22734
|
* @function
|
|
22654
22735
|
* @returns {Line} this instance for objecf chaining
|
|
22655
22736
|
*/
|
|
@@ -22685,7 +22766,7 @@
|
|
|
22685
22766
|
/**
|
|
22686
22767
|
* clone this line segment
|
|
22687
22768
|
* @name clone
|
|
22688
|
-
* @memberof Line
|
|
22769
|
+
* @memberof Line
|
|
22689
22770
|
* @function
|
|
22690
22771
|
* @returns {Line} new Line
|
|
22691
22772
|
*/
|
|
@@ -22731,7 +22812,7 @@
|
|
|
22731
22812
|
/**
|
|
22732
22813
|
* begin a new path
|
|
22733
22814
|
* @name beginPath
|
|
22734
|
-
* @memberof Path2D
|
|
22815
|
+
* @memberof Path2D
|
|
22735
22816
|
* @function
|
|
22736
22817
|
*/
|
|
22737
22818
|
Path2D$1.prototype.beginPath = function beginPath () {
|
|
@@ -22747,7 +22828,7 @@
|
|
|
22747
22828
|
* It tries to draw a straight line from the current point to the start.
|
|
22748
22829
|
* If the shape has already been closed or has only one point, this function does nothing.
|
|
22749
22830
|
* @name closePath
|
|
22750
|
-
* @memberof Path2D
|
|
22831
|
+
* @memberof Path2D
|
|
22751
22832
|
* @function
|
|
22752
22833
|
*/
|
|
22753
22834
|
Path2D$1.prototype.closePath = function closePath () {
|
|
@@ -22760,7 +22841,7 @@
|
|
|
22760
22841
|
/**
|
|
22761
22842
|
* triangulate the shape defined by this path into an array of triangles
|
|
22762
22843
|
* @name triangulatePath
|
|
22763
|
-
* @memberof Path2D
|
|
22844
|
+
* @memberof Path2D
|
|
22764
22845
|
* @function
|
|
22765
22846
|
* @returns {Vector2d[]}
|
|
22766
22847
|
*/
|
|
@@ -22791,7 +22872,7 @@
|
|
|
22791
22872
|
/**
|
|
22792
22873
|
* moves the starting point of the current path to the (x, y) coordinates.
|
|
22793
22874
|
* @name moveTo
|
|
22794
|
-
* @memberof Path2D
|
|
22875
|
+
* @memberof Path2D
|
|
22795
22876
|
* @function
|
|
22796
22877
|
* @param {number} x the x-axis (horizontal) coordinate of the point.
|
|
22797
22878
|
* @param {number} y the y-axis (vertical) coordinate of the point.
|
|
@@ -22803,7 +22884,7 @@
|
|
|
22803
22884
|
/**
|
|
22804
22885
|
* connects the last point in the current patch to the (x, y) coordinates with a straight line.
|
|
22805
22886
|
* @name lineTo
|
|
22806
|
-
* @memberof Path2D
|
|
22887
|
+
* @memberof Path2D
|
|
22807
22888
|
* @function
|
|
22808
22889
|
* @param {number} x the x-axis coordinate of the line's end point.
|
|
22809
22890
|
* @param {number} y the y-axis coordinate of the line's end point.
|
|
@@ -22816,7 +22897,7 @@
|
|
|
22816
22897
|
* adds an arc to the current path which is centered at (x, y) position with the given radius,
|
|
22817
22898
|
* starting at startAngle and ending at endAngle going in the given direction by counterclockwise (defaulting to clockwise).
|
|
22818
22899
|
* @name arc
|
|
22819
|
-
* @memberof Path2D
|
|
22900
|
+
* @memberof Path2D
|
|
22820
22901
|
* @function
|
|
22821
22902
|
* @param {number} x the horizontal coordinate of the arc's center.
|
|
22822
22903
|
* @param {number} y the vertical coordinate of the arc's center.
|
|
@@ -22868,7 +22949,7 @@
|
|
|
22868
22949
|
/**
|
|
22869
22950
|
* adds a circular arc to the path with the given control points and radius, connected to the previous point by a straight line.
|
|
22870
22951
|
* @name arcTo
|
|
22871
|
-
* @memberof Path2D
|
|
22952
|
+
* @memberof Path2D
|
|
22872
22953
|
* @function
|
|
22873
22954
|
* @param {number} x the x-axis coordinate of the first control point.
|
|
22874
22955
|
* @param {number} y the y-axis coordinate of the first control point.
|
|
@@ -22917,7 +22998,7 @@
|
|
|
22917
22998
|
* adds an elliptical arc to the path which is centered at (x, y) position with the radii radiusX and radiusY
|
|
22918
22999
|
* starting at startAngle and ending at endAngle going in the given direction by counterclockwise.
|
|
22919
23000
|
* @name ellipse
|
|
22920
|
-
* @memberof Path2D
|
|
23001
|
+
* @memberof Path2D
|
|
22921
23002
|
* @function
|
|
22922
23003
|
* @param {number} x the x-axis (horizontal) coordinate of the ellipse's center.
|
|
22923
23004
|
* @param {number} y the y-axis (vertical) coordinate of the ellipse's center.
|
|
@@ -22979,7 +23060,7 @@
|
|
|
22979
23060
|
/**
|
|
22980
23061
|
* creates a path for a rectangle at position (x, y) with a size that is determined by width and height.
|
|
22981
23062
|
* @name rect
|
|
22982
|
-
* @memberof Path2D
|
|
23063
|
+
* @memberof Path2D
|
|
22983
23064
|
* @function
|
|
22984
23065
|
* @param {number} x the x-axis coordinate of the rectangle's starting point.
|
|
22985
23066
|
* @param {number} y the y-axis coordinate of the rectangle's starting point.
|
|
@@ -22997,7 +23078,7 @@
|
|
|
22997
23078
|
/**
|
|
22998
23079
|
* adds an rounded rectangle to the current path.
|
|
22999
23080
|
* @name roundRect
|
|
23000
|
-
* @memberof Path2D
|
|
23081
|
+
* @memberof Path2D
|
|
23001
23082
|
* @function
|
|
23002
23083
|
* @param {number} x the x-axis coordinate of the rectangle's starting point.
|
|
23003
23084
|
* @param {number} y the y-axis coordinate of the rectangle's starting point.
|
|
@@ -23053,6 +23134,11 @@
|
|
|
23053
23134
|
*/
|
|
23054
23135
|
this.currentScissor = new Int32Array([ 0, 0, this.settings.width, this.settings.height ]);
|
|
23055
23136
|
|
|
23137
|
+
/**
|
|
23138
|
+
* @ignore
|
|
23139
|
+
*/
|
|
23140
|
+
this.maskLevel = 0;
|
|
23141
|
+
|
|
23056
23142
|
/**
|
|
23057
23143
|
* @ignore
|
|
23058
23144
|
*/
|
|
@@ -23096,7 +23182,7 @@
|
|
|
23096
23182
|
/**
|
|
23097
23183
|
* prepare the framebuffer for drawing a new frame
|
|
23098
23184
|
* @name clear
|
|
23099
|
-
* @memberof Renderer
|
|
23185
|
+
* @memberof Renderer
|
|
23100
23186
|
* @function
|
|
23101
23187
|
*/
|
|
23102
23188
|
Renderer.prototype.clear = function clear () {};
|
|
@@ -23104,7 +23190,7 @@
|
|
|
23104
23190
|
/**
|
|
23105
23191
|
* Reset context state
|
|
23106
23192
|
* @name reset
|
|
23107
|
-
* @memberof Renderer
|
|
23193
|
+
* @memberof Renderer
|
|
23108
23194
|
* @function
|
|
23109
23195
|
*/
|
|
23110
23196
|
Renderer.prototype.reset = function reset () {
|
|
@@ -23117,12 +23203,13 @@
|
|
|
23117
23203
|
this.currentScissor[1] = 0;
|
|
23118
23204
|
this.currentScissor[2] = this.backBufferCanvas.width;
|
|
23119
23205
|
this.currentScissor[3] = this.backBufferCanvas.height;
|
|
23206
|
+
this.clearMask();
|
|
23120
23207
|
};
|
|
23121
23208
|
|
|
23122
23209
|
/**
|
|
23123
23210
|
* return a reference to the system canvas
|
|
23124
23211
|
* @name getCanvas
|
|
23125
|
-
* @memberof Renderer
|
|
23212
|
+
* @memberof Renderer
|
|
23126
23213
|
* @function
|
|
23127
23214
|
* @returns {HTMLCanvasElement}
|
|
23128
23215
|
*/
|
|
@@ -23133,7 +23220,7 @@
|
|
|
23133
23220
|
/**
|
|
23134
23221
|
* return a reference to the screen canvas
|
|
23135
23222
|
* @name getScreenCanvas
|
|
23136
|
-
* @memberof Renderer
|
|
23223
|
+
* @memberof Renderer
|
|
23137
23224
|
* @function
|
|
23138
23225
|
* @returns {HTMLCanvasElement}
|
|
23139
23226
|
*/
|
|
@@ -23145,7 +23232,7 @@
|
|
|
23145
23232
|
* return a reference to the screen canvas corresponding 2d Context<br>
|
|
23146
23233
|
* (will return buffered context if double buffering is enabled, or a reference to the Screen Context)
|
|
23147
23234
|
* @name getScreenContext
|
|
23148
|
-
* @memberof Renderer
|
|
23235
|
+
* @memberof Renderer
|
|
23149
23236
|
* @function
|
|
23150
23237
|
* @returns {CanvasRenderingContext2D}
|
|
23151
23238
|
*/
|
|
@@ -23156,7 +23243,7 @@
|
|
|
23156
23243
|
/**
|
|
23157
23244
|
* returns the current blend mode for this renderer
|
|
23158
23245
|
* @name getBlendMode
|
|
23159
|
-
* @memberof Renderer
|
|
23246
|
+
* @memberof Renderer
|
|
23160
23247
|
* @function
|
|
23161
23248
|
* @returns {string} blend mode
|
|
23162
23249
|
*/
|
|
@@ -23168,7 +23255,7 @@
|
|
|
23168
23255
|
* Returns the 2D Context object of the given Canvas<br>
|
|
23169
23256
|
* Also configures anti-aliasing and blend modes based on constructor options.
|
|
23170
23257
|
* @name getContext2d
|
|
23171
|
-
* @memberof Renderer
|
|
23258
|
+
* @memberof Renderer
|
|
23172
23259
|
* @function
|
|
23173
23260
|
* @param {HTMLCanvasElement} canvas
|
|
23174
23261
|
* @param {boolean} [transparent=true] use false to disable transparency
|
|
@@ -23206,7 +23293,7 @@
|
|
|
23206
23293
|
/**
|
|
23207
23294
|
* return the width of the system Canvas
|
|
23208
23295
|
* @name getWidth
|
|
23209
|
-
* @memberof Renderer
|
|
23296
|
+
* @memberof Renderer
|
|
23210
23297
|
* @function
|
|
23211
23298
|
* @returns {number}
|
|
23212
23299
|
*/
|
|
@@ -23217,7 +23304,7 @@
|
|
|
23217
23304
|
/**
|
|
23218
23305
|
* return the height of the system Canvas
|
|
23219
23306
|
* @name getHeight
|
|
23220
|
-
* @memberof Renderer
|
|
23307
|
+
* @memberof Renderer
|
|
23221
23308
|
* @function
|
|
23222
23309
|
* @returns {number} height of the system Canvas
|
|
23223
23310
|
*/
|
|
@@ -23228,7 +23315,7 @@
|
|
|
23228
23315
|
/**
|
|
23229
23316
|
* get the current fill & stroke style color.
|
|
23230
23317
|
* @name getColor
|
|
23231
|
-
* @memberof Renderer
|
|
23318
|
+
* @memberof Renderer
|
|
23232
23319
|
* @function
|
|
23233
23320
|
* @returns {Color} current global color
|
|
23234
23321
|
*/
|
|
@@ -23239,7 +23326,7 @@
|
|
|
23239
23326
|
/**
|
|
23240
23327
|
* return the current global alpha
|
|
23241
23328
|
* @name globalAlpha
|
|
23242
|
-
* @memberof Renderer
|
|
23329
|
+
* @memberof Renderer
|
|
23243
23330
|
* @function
|
|
23244
23331
|
* @returns {number}
|
|
23245
23332
|
*/
|
|
@@ -23250,7 +23337,7 @@
|
|
|
23250
23337
|
/**
|
|
23251
23338
|
* check if the given rect or bounds overlaps with the renderer screen coordinates
|
|
23252
23339
|
* @name overlaps
|
|
23253
|
-
* @memberof Renderer
|
|
23340
|
+
* @memberof Renderer
|
|
23254
23341
|
* @function
|
|
23255
23342
|
* @param {Rect|Bounds} bounds
|
|
23256
23343
|
* @returns {boolean} true if overlaps
|
|
@@ -23266,7 +23353,7 @@
|
|
|
23266
23353
|
/**
|
|
23267
23354
|
* resizes the system canvas
|
|
23268
23355
|
* @name resize
|
|
23269
|
-
* @memberof Renderer
|
|
23356
|
+
* @memberof Renderer
|
|
23270
23357
|
* @function
|
|
23271
23358
|
* @param {number} width new width of the canvas
|
|
23272
23359
|
* @param {number} height new height of the canvas
|
|
@@ -23287,7 +23374,7 @@
|
|
|
23287
23374
|
/**
|
|
23288
23375
|
* enable/disable image smoothing (scaling interpolation) for the given context
|
|
23289
23376
|
* @name setAntiAlias
|
|
23290
|
-
* @memberof Renderer
|
|
23377
|
+
* @memberof Renderer
|
|
23291
23378
|
* @function
|
|
23292
23379
|
* @param {CanvasRenderingContext2D} context
|
|
23293
23380
|
* @param {boolean} [enable=false]
|
|
@@ -23317,7 +23404,7 @@
|
|
|
23317
23404
|
/**
|
|
23318
23405
|
* set/change the current projection matrix (WebGL only)
|
|
23319
23406
|
* @name setProjection
|
|
23320
|
-
* @memberof Renderer
|
|
23407
|
+
* @memberof Renderer
|
|
23321
23408
|
* @function
|
|
23322
23409
|
* @param {Matrix3d} matrix
|
|
23323
23410
|
*/
|
|
@@ -23328,13 +23415,17 @@
|
|
|
23328
23415
|
/**
|
|
23329
23416
|
* stroke the given shape
|
|
23330
23417
|
* @name stroke
|
|
23331
|
-
* @memberof Renderer
|
|
23418
|
+
* @memberof Renderer
|
|
23332
23419
|
* @function
|
|
23333
23420
|
* @param {Rect|RoundRect|Polygon|Line|Ellipse} shape a shape object to stroke
|
|
23334
23421
|
* @param {boolean} [fill=false] fill the shape with the current color if true
|
|
23335
23422
|
*/
|
|
23336
23423
|
Renderer.prototype.stroke = function stroke (shape, fill) {
|
|
23337
|
-
if (shape instanceof
|
|
23424
|
+
if (shape instanceof RoundRect) {
|
|
23425
|
+
this.strokeRoundRect(shape.left, shape.top, shape.width, shape.height, shape.radius, fill);
|
|
23426
|
+
return;
|
|
23427
|
+
}
|
|
23428
|
+
if (shape instanceof Rect$1 || shape instanceof Bounds$1) {
|
|
23338
23429
|
this.strokeRect(shape.left, shape.top, shape.width, shape.height, fill);
|
|
23339
23430
|
return;
|
|
23340
23431
|
}
|
|
@@ -23342,10 +23433,6 @@
|
|
|
23342
23433
|
this.strokePolygon(shape, fill);
|
|
23343
23434
|
return;
|
|
23344
23435
|
}
|
|
23345
|
-
if (shape instanceof RoundRect) {
|
|
23346
|
-
this.strokeRoundRect(shape.left, shape.top, shape.width, shape.height, shape.radius, fill);
|
|
23347
|
-
return;
|
|
23348
|
-
}
|
|
23349
23436
|
if (shape instanceof Ellipse) {
|
|
23350
23437
|
this.strokeEllipse(
|
|
23351
23438
|
shape.pos.x,
|
|
@@ -23362,7 +23449,7 @@
|
|
|
23362
23449
|
/**
|
|
23363
23450
|
* fill the given shape
|
|
23364
23451
|
* @name fill
|
|
23365
|
-
* @memberof Renderer
|
|
23452
|
+
* @memberof Renderer
|
|
23366
23453
|
* @function
|
|
23367
23454
|
* @param {Rect|RoundRect|Polygon|Line|Ellipse} shape a shape object to fill
|
|
23368
23455
|
*/
|
|
@@ -23373,7 +23460,7 @@
|
|
|
23373
23460
|
/**
|
|
23374
23461
|
* tint the given image or canvas using the given color
|
|
23375
23462
|
* @name tint
|
|
23376
|
-
* @memberof Renderer
|
|
23463
|
+
* @memberof Renderer
|
|
23377
23464
|
* @function
|
|
23378
23465
|
* @param {HTMLImageElement|HTMLCanvasElement|OffscreenCanvas} src the source image to be tinted
|
|
23379
23466
|
* @param {Color|string} color the color that will be used to tint the image
|
|
@@ -23404,9 +23491,10 @@
|
|
|
23404
23491
|
* So, if the renderable is larger than the mask, only the intersecting part of the renderable will be visible.
|
|
23405
23492
|
* Mask are not preserved through renderer context save and restore.
|
|
23406
23493
|
* @name setMask
|
|
23407
|
-
* @memberof Renderer
|
|
23494
|
+
* @memberof Renderer
|
|
23408
23495
|
* @function
|
|
23409
23496
|
* @param {Rect|RoundRect|Polygon|Line|Ellipse} [mask] the shape defining the mask to be applied
|
|
23497
|
+
* @param {boolean} [invert=false] either the given shape should define what is visible (default) or the opposite
|
|
23410
23498
|
*/
|
|
23411
23499
|
// eslint-disable-next-line no-unused-vars
|
|
23412
23500
|
Renderer.prototype.setMask = function setMask (mask) {};
|
|
@@ -23415,7 +23503,7 @@
|
|
|
23415
23503
|
* disable (remove) the rendering mask set through setMask.
|
|
23416
23504
|
* @name clearMask
|
|
23417
23505
|
* @see Renderer#setMask
|
|
23418
|
-
* @memberof Renderer
|
|
23506
|
+
* @memberof Renderer
|
|
23419
23507
|
* @function
|
|
23420
23508
|
*/
|
|
23421
23509
|
Renderer.prototype.clearMask = function clearMask () {};
|
|
@@ -23423,7 +23511,7 @@
|
|
|
23423
23511
|
/**
|
|
23424
23512
|
* set a coloring tint for sprite based renderables
|
|
23425
23513
|
* @name setTint
|
|
23426
|
-
* @memberof Renderer
|
|
23514
|
+
* @memberof Renderer
|
|
23427
23515
|
* @function
|
|
23428
23516
|
* @param {Color} tint the tint color
|
|
23429
23517
|
* @param {number} [alpha] an alpha value to be applied to the tint
|
|
@@ -23440,7 +23528,7 @@
|
|
|
23440
23528
|
* clear the rendering tint set through setTint.
|
|
23441
23529
|
* @name clearTint
|
|
23442
23530
|
* @see Renderer#setTint
|
|
23443
|
-
* @memberof Renderer
|
|
23531
|
+
* @memberof Renderer
|
|
23444
23532
|
* @function
|
|
23445
23533
|
*/
|
|
23446
23534
|
Renderer.prototype.clearTint = function clearTint () {
|
|
@@ -23511,7 +23599,7 @@
|
|
|
23511
23599
|
/**
|
|
23512
23600
|
* Reset context state
|
|
23513
23601
|
* @name reset
|
|
23514
|
-
* @memberof CanvasRenderer
|
|
23602
|
+
* @memberof CanvasRenderer
|
|
23515
23603
|
* @function
|
|
23516
23604
|
*/
|
|
23517
23605
|
CanvasRenderer.prototype.reset = function reset () {
|
|
@@ -23522,7 +23610,7 @@
|
|
|
23522
23610
|
/**
|
|
23523
23611
|
* Reset the canvas transform to identity
|
|
23524
23612
|
* @name resetTransform
|
|
23525
|
-
* @memberof CanvasRenderer
|
|
23613
|
+
* @memberof CanvasRenderer
|
|
23526
23614
|
* @function
|
|
23527
23615
|
*/
|
|
23528
23616
|
CanvasRenderer.prototype.resetTransform = function resetTransform () {
|
|
@@ -23542,7 +23630,7 @@
|
|
|
23542
23630
|
* <img src="images/screen-blendmode.png" width="510"/> <br>
|
|
23543
23631
|
* @name setBlendMode
|
|
23544
23632
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/globalCompositeOperation
|
|
23545
|
-
* @memberof CanvasRenderer
|
|
23633
|
+
* @memberof CanvasRenderer
|
|
23546
23634
|
* @function
|
|
23547
23635
|
* @param {string} [mode="normal"] blend mode : "normal", "multiply", "lighter, "additive", "screen"
|
|
23548
23636
|
* @param {CanvasRenderingContext2D} [context]
|
|
@@ -23582,7 +23670,7 @@
|
|
|
23582
23670
|
/**
|
|
23583
23671
|
* prepare the framebuffer for drawing a new frame
|
|
23584
23672
|
* @name clear
|
|
23585
|
-
* @memberof CanvasRenderer
|
|
23673
|
+
* @memberof CanvasRenderer
|
|
23586
23674
|
* @function
|
|
23587
23675
|
*/
|
|
23588
23676
|
CanvasRenderer.prototype.clear = function clear () {
|
|
@@ -23594,7 +23682,7 @@
|
|
|
23594
23682
|
/**
|
|
23595
23683
|
* render the main framebuffer on screen
|
|
23596
23684
|
* @name flush
|
|
23597
|
-
* @memberof CanvasRenderer
|
|
23685
|
+
* @memberof CanvasRenderer
|
|
23598
23686
|
* @function
|
|
23599
23687
|
*/
|
|
23600
23688
|
CanvasRenderer.prototype.flush = function flush () {
|
|
@@ -23606,7 +23694,7 @@
|
|
|
23606
23694
|
/**
|
|
23607
23695
|
* Clears the main framebuffer with the given color
|
|
23608
23696
|
* @name clearColor
|
|
23609
|
-
* @memberof CanvasRenderer
|
|
23697
|
+
* @memberof CanvasRenderer
|
|
23610
23698
|
* @function
|
|
23611
23699
|
* @param {Color|string} [color="#000000"] CSS color.
|
|
23612
23700
|
* @param {boolean} [opaque=false] Allow transparency [default] or clear the surface completely [true]
|
|
@@ -23625,7 +23713,7 @@
|
|
|
23625
23713
|
/**
|
|
23626
23714
|
* Erase the pixels in the given rectangular area by setting them to transparent black (rgba(0,0,0,0)).
|
|
23627
23715
|
* @name clearRect
|
|
23628
|
-
* @memberof CanvasRenderer
|
|
23716
|
+
* @memberof CanvasRenderer
|
|
23629
23717
|
* @function
|
|
23630
23718
|
* @param {number} x x axis of the coordinate for the rectangle starting point.
|
|
23631
23719
|
* @param {number} y y axis of the coordinate for the rectangle starting point.
|
|
@@ -23639,7 +23727,7 @@
|
|
|
23639
23727
|
/**
|
|
23640
23728
|
* Create a pattern with the specified repetition
|
|
23641
23729
|
* @name createPattern
|
|
23642
|
-
* @memberof CanvasRenderer
|
|
23730
|
+
* @memberof CanvasRenderer
|
|
23643
23731
|
* @function
|
|
23644
23732
|
* @param {Image} image Source image
|
|
23645
23733
|
* @param {string} repeat Define how the pattern should be repeated
|
|
@@ -23658,7 +23746,7 @@
|
|
|
23658
23746
|
/**
|
|
23659
23747
|
* Draw an image onto the main using the canvas api
|
|
23660
23748
|
* @name drawImage
|
|
23661
|
-
* @memberof CanvasRenderer
|
|
23749
|
+
* @memberof CanvasRenderer
|
|
23662
23750
|
* @function
|
|
23663
23751
|
* @param {Image} image An element to draw into the context. The specification permits any canvas image source (CanvasImageSource), specifically, a CSSImageValue, an HTMLImageElement, an SVGImageElement, an HTMLVideoElement, an HTMLCanvasElement, an ImageBitmap, or an OffscreenCanvas.
|
|
23664
23752
|
* @param {number} sx The X coordinate of the top left corner of the sub-rectangle of the source image to draw into the destination context.
|
|
@@ -23722,7 +23810,7 @@
|
|
|
23722
23810
|
/**
|
|
23723
23811
|
* Draw a pattern within the given rectangle.
|
|
23724
23812
|
* @name drawPattern
|
|
23725
|
-
* @memberof CanvasRenderer
|
|
23813
|
+
* @memberof CanvasRenderer
|
|
23726
23814
|
* @function
|
|
23727
23815
|
* @param {CanvasPattern} pattern Pattern object
|
|
23728
23816
|
* @param {number} x
|
|
@@ -23746,7 +23834,7 @@
|
|
|
23746
23834
|
/**
|
|
23747
23835
|
* Stroke an arc at the specified coordinates with given radius, start and end points
|
|
23748
23836
|
* @name strokeArc
|
|
23749
|
-
* @memberof CanvasRenderer
|
|
23837
|
+
* @memberof CanvasRenderer
|
|
23750
23838
|
* @function
|
|
23751
23839
|
* @param {number} x arc center point x-axis
|
|
23752
23840
|
* @param {number} y arc center point y-axis
|
|
@@ -23775,7 +23863,7 @@
|
|
|
23775
23863
|
/**
|
|
23776
23864
|
* Fill an arc at the specified coordinates with given radius, start and end points
|
|
23777
23865
|
* @name fillArc
|
|
23778
|
-
* @memberof CanvasRenderer
|
|
23866
|
+
* @memberof CanvasRenderer
|
|
23779
23867
|
* @function
|
|
23780
23868
|
* @param {number} x arc center point x-axis
|
|
23781
23869
|
* @param {number} y arc center point y-axis
|
|
@@ -23791,7 +23879,7 @@
|
|
|
23791
23879
|
/**
|
|
23792
23880
|
* Stroke an ellipse at the specified coordinates with given radius
|
|
23793
23881
|
* @name strokeEllipse
|
|
23794
|
-
* @memberof CanvasRenderer
|
|
23882
|
+
* @memberof CanvasRenderer
|
|
23795
23883
|
* @function
|
|
23796
23884
|
* @param {number} x ellipse center point x-axis
|
|
23797
23885
|
* @param {number} y ellipse center point y-axis
|
|
@@ -23835,7 +23923,7 @@
|
|
|
23835
23923
|
/**
|
|
23836
23924
|
* Fill an ellipse at the specified coordinates with given radius
|
|
23837
23925
|
* @name fillEllipse
|
|
23838
|
-
* @memberof CanvasRenderer
|
|
23926
|
+
* @memberof CanvasRenderer
|
|
23839
23927
|
* @function
|
|
23840
23928
|
* @param {number} x ellipse center point x-axis
|
|
23841
23929
|
* @param {number} y ellipse center point y-axis
|
|
@@ -23849,7 +23937,7 @@
|
|
|
23849
23937
|
/**
|
|
23850
23938
|
* Stroke a line of the given two points
|
|
23851
23939
|
* @name strokeLine
|
|
23852
|
-
* @memberof CanvasRenderer
|
|
23940
|
+
* @memberof CanvasRenderer
|
|
23853
23941
|
* @function
|
|
23854
23942
|
* @param {number} startX the start x coordinate
|
|
23855
23943
|
* @param {number} startY the start y coordinate
|
|
@@ -23871,7 +23959,7 @@
|
|
|
23871
23959
|
/**
|
|
23872
23960
|
* Fill a line of the given two points
|
|
23873
23961
|
* @name fillLine
|
|
23874
|
-
* @memberof CanvasRenderer
|
|
23962
|
+
* @memberof CanvasRenderer
|
|
23875
23963
|
* @function
|
|
23876
23964
|
* @param {number} startX the start x coordinate
|
|
23877
23965
|
* @param {number} startY the start y coordinate
|
|
@@ -23885,7 +23973,7 @@
|
|
|
23885
23973
|
/**
|
|
23886
23974
|
* Stroke the given me.Polygon on the screen
|
|
23887
23975
|
* @name strokePolygon
|
|
23888
|
-
* @memberof CanvasRenderer
|
|
23976
|
+
* @memberof CanvasRenderer
|
|
23889
23977
|
* @function
|
|
23890
23978
|
* @param {Polygon} poly the shape to draw
|
|
23891
23979
|
* @param {boolean} [fill=false] also fill the shape with the current color if true
|
|
@@ -23916,7 +24004,7 @@
|
|
|
23916
24004
|
/**
|
|
23917
24005
|
* Fill the given me.Polygon on the screen
|
|
23918
24006
|
* @name fillPolygon
|
|
23919
|
-
* @memberof CanvasRenderer
|
|
24007
|
+
* @memberof CanvasRenderer
|
|
23920
24008
|
* @function
|
|
23921
24009
|
* @param {Polygon} poly the shape to draw
|
|
23922
24010
|
*/
|
|
@@ -23927,7 +24015,7 @@
|
|
|
23927
24015
|
/**
|
|
23928
24016
|
* Stroke a rectangle at the specified coordinates
|
|
23929
24017
|
* @name strokeRect
|
|
23930
|
-
* @memberof CanvasRenderer
|
|
24018
|
+
* @memberof CanvasRenderer
|
|
23931
24019
|
* @function
|
|
23932
24020
|
* @param {number} x
|
|
23933
24021
|
* @param {number} y
|
|
@@ -23950,7 +24038,7 @@
|
|
|
23950
24038
|
/**
|
|
23951
24039
|
* Draw a filled rectangle at the specified coordinates
|
|
23952
24040
|
* @name fillRect
|
|
23953
|
-
* @memberof CanvasRenderer
|
|
24041
|
+
* @memberof CanvasRenderer
|
|
23954
24042
|
* @function
|
|
23955
24043
|
* @param {number} x
|
|
23956
24044
|
* @param {number} y
|
|
@@ -23964,7 +24052,7 @@
|
|
|
23964
24052
|
/**
|
|
23965
24053
|
* Stroke a rounded rectangle at the specified coordinates
|
|
23966
24054
|
* @name strokeRoundRect
|
|
23967
|
-
* @memberof CanvasRenderer
|
|
24055
|
+
* @memberof CanvasRenderer
|
|
23968
24056
|
* @function
|
|
23969
24057
|
* @param {number} x
|
|
23970
24058
|
* @param {number} y
|
|
@@ -23990,7 +24078,7 @@
|
|
|
23990
24078
|
/**
|
|
23991
24079
|
* Draw a rounded filled rectangle at the specified coordinates
|
|
23992
24080
|
* @name fillRoundRect
|
|
23993
|
-
* @memberof CanvasRenderer
|
|
24081
|
+
* @memberof CanvasRenderer
|
|
23994
24082
|
* @function
|
|
23995
24083
|
* @param {number} x
|
|
23996
24084
|
* @param {number} y
|
|
@@ -24006,7 +24094,7 @@
|
|
|
24006
24094
|
/**
|
|
24007
24095
|
* return a reference to the system 2d Context
|
|
24008
24096
|
* @name getContext
|
|
24009
|
-
* @memberof CanvasRenderer
|
|
24097
|
+
* @memberof CanvasRenderer
|
|
24010
24098
|
* @function
|
|
24011
24099
|
* @returns {CanvasRenderingContext2D}
|
|
24012
24100
|
*/
|
|
@@ -24026,7 +24114,7 @@
|
|
|
24026
24114
|
/**
|
|
24027
24115
|
* save the canvas context
|
|
24028
24116
|
* @name save
|
|
24029
|
-
* @memberof CanvasRenderer
|
|
24117
|
+
* @memberof CanvasRenderer
|
|
24030
24118
|
* @function
|
|
24031
24119
|
*/
|
|
24032
24120
|
CanvasRenderer.prototype.save = function save () {
|
|
@@ -24036,7 +24124,7 @@
|
|
|
24036
24124
|
/**
|
|
24037
24125
|
* restores the canvas context
|
|
24038
24126
|
* @name restore
|
|
24039
|
-
* @memberof CanvasRenderer
|
|
24127
|
+
* @memberof CanvasRenderer
|
|
24040
24128
|
* @function
|
|
24041
24129
|
*/
|
|
24042
24130
|
CanvasRenderer.prototype.restore = function restore () {
|
|
@@ -24051,7 +24139,7 @@
|
|
|
24051
24139
|
/**
|
|
24052
24140
|
* rotates the canvas context
|
|
24053
24141
|
* @name rotate
|
|
24054
|
-
* @memberof CanvasRenderer
|
|
24142
|
+
* @memberof CanvasRenderer
|
|
24055
24143
|
* @function
|
|
24056
24144
|
* @param {number} angle in radians
|
|
24057
24145
|
*/
|
|
@@ -24062,7 +24150,7 @@
|
|
|
24062
24150
|
/**
|
|
24063
24151
|
* scales the canvas context
|
|
24064
24152
|
* @name scale
|
|
24065
|
-
* @memberof CanvasRenderer
|
|
24153
|
+
* @memberof CanvasRenderer
|
|
24066
24154
|
* @function
|
|
24067
24155
|
* @param {number} x
|
|
24068
24156
|
* @param {number} y
|
|
@@ -24075,7 +24163,7 @@
|
|
|
24075
24163
|
* Set the current fill & stroke style color.
|
|
24076
24164
|
* By default, or upon reset, the value is set to #000000.
|
|
24077
24165
|
* @name setColor
|
|
24078
|
-
* @memberof CanvasRenderer
|
|
24166
|
+
* @memberof CanvasRenderer
|
|
24079
24167
|
* @function
|
|
24080
24168
|
* @param {Color|string} color css color value
|
|
24081
24169
|
*/
|
|
@@ -24091,7 +24179,7 @@
|
|
|
24091
24179
|
/**
|
|
24092
24180
|
* Set the global alpha
|
|
24093
24181
|
* @name setGlobalAlpha
|
|
24094
|
-
* @memberof CanvasRenderer
|
|
24182
|
+
* @memberof CanvasRenderer
|
|
24095
24183
|
* @function
|
|
24096
24184
|
* @param {number} alpha 0.0 to 1.0 values accepted.
|
|
24097
24185
|
*/
|
|
@@ -24102,7 +24190,7 @@
|
|
|
24102
24190
|
/**
|
|
24103
24191
|
* Return the global alpha
|
|
24104
24192
|
* @name getGlobalAlpha
|
|
24105
|
-
* @memberof CanvasRenderer
|
|
24193
|
+
* @memberof CanvasRenderer
|
|
24106
24194
|
* @function
|
|
24107
24195
|
* @returns {number} global alpha value
|
|
24108
24196
|
*/
|
|
@@ -24113,7 +24201,7 @@
|
|
|
24113
24201
|
/**
|
|
24114
24202
|
* Set the line width on the context
|
|
24115
24203
|
* @name setLineWidth
|
|
24116
|
-
* @memberof CanvasRenderer
|
|
24204
|
+
* @memberof CanvasRenderer
|
|
24117
24205
|
* @function
|
|
24118
24206
|
* @param {number} width Line width
|
|
24119
24207
|
*/
|
|
@@ -24125,7 +24213,7 @@
|
|
|
24125
24213
|
* Reset (overrides) the renderer transformation matrix to the
|
|
24126
24214
|
* identity one, and then apply the given transformation matrix.
|
|
24127
24215
|
* @name setTransform
|
|
24128
|
-
* @memberof CanvasRenderer
|
|
24216
|
+
* @memberof CanvasRenderer
|
|
24129
24217
|
* @function
|
|
24130
24218
|
* @param {Matrix2d} mat2d Matrix to transform by
|
|
24131
24219
|
*/
|
|
@@ -24137,7 +24225,7 @@
|
|
|
24137
24225
|
/**
|
|
24138
24226
|
* Multiply given matrix into the renderer tranformation matrix
|
|
24139
24227
|
* @name transform
|
|
24140
|
-
* @memberof CanvasRenderer
|
|
24228
|
+
* @memberof CanvasRenderer
|
|
24141
24229
|
* @function
|
|
24142
24230
|
* @param {Matrix2d} mat2d Matrix to transform by
|
|
24143
24231
|
*/
|
|
@@ -24161,7 +24249,7 @@
|
|
|
24161
24249
|
/**
|
|
24162
24250
|
* Translates the context to the given position
|
|
24163
24251
|
* @name translate
|
|
24164
|
-
* @memberof CanvasRenderer
|
|
24252
|
+
* @memberof CanvasRenderer
|
|
24165
24253
|
* @function
|
|
24166
24254
|
* @param {number} x
|
|
24167
24255
|
* @param {number} y
|
|
@@ -24181,7 +24269,7 @@
|
|
|
24181
24269
|
* and restore it (with the restore() method) any time in the future.
|
|
24182
24270
|
* (<u>this is an experimental feature !</u>)
|
|
24183
24271
|
* @name clipRect
|
|
24184
|
-
* @memberof CanvasRenderer
|
|
24272
|
+
* @memberof CanvasRenderer
|
|
24185
24273
|
* @function
|
|
24186
24274
|
* @param {number} x
|
|
24187
24275
|
* @param {number} y
|
|
@@ -24214,21 +24302,30 @@
|
|
|
24214
24302
|
* So, if the renderable is larger than the mask, only the intersecting part of the renderable will be visible.
|
|
24215
24303
|
* Mask are not preserved through renderer context save and restore.
|
|
24216
24304
|
* @name setMask
|
|
24217
|
-
* @memberof CanvasRenderer
|
|
24305
|
+
* @memberof CanvasRenderer
|
|
24218
24306
|
* @function
|
|
24219
24307
|
* @param {Rect|RoundRect|Polygon|Line|Ellipse} [mask] the shape defining the mask to be applied
|
|
24308
|
+
* @param {boolean} [invert=false] either the given shape should define what is visible (default) or the opposite
|
|
24220
24309
|
*/
|
|
24221
|
-
CanvasRenderer.prototype.setMask = function setMask (mask) {
|
|
24222
|
-
|
|
24223
|
-
var _x = mask.pos.x, _y = mask.pos.y;
|
|
24310
|
+
CanvasRenderer.prototype.setMask = function setMask (mask, invert) {
|
|
24311
|
+
if ( invert === void 0 ) invert = false;
|
|
24224
24312
|
|
|
24225
|
-
context.
|
|
24313
|
+
var context = this.getContext();
|
|
24226
24314
|
|
|
24227
|
-
|
|
24315
|
+
if (this.maskLevel === 0) {
|
|
24316
|
+
// only save context on the first mask
|
|
24317
|
+
context.save();
|
|
24318
|
+
context.beginPath();
|
|
24319
|
+
}
|
|
24228
24320
|
|
|
24229
24321
|
// https://github.com/melonjs/melonJS/issues/648
|
|
24230
|
-
if (mask instanceof
|
|
24231
|
-
|
|
24322
|
+
else if (mask instanceof RoundRect) {
|
|
24323
|
+
context.roundRect(mask.top, mask.left, mask.width, mask.height, mask.radius);
|
|
24324
|
+
} else if (mask instanceof Rect || mask instanceof Bounds$1) {
|
|
24325
|
+
context.rect(mask.top, mask.left, mask.width, mask.height);
|
|
24326
|
+
} else if (mask instanceof Ellipse) {
|
|
24327
|
+
var _x = mask.pos.x, _y = mask.pos.y,
|
|
24328
|
+
hw = mask.radiusV.x,
|
|
24232
24329
|
hh = mask.radiusV.y,
|
|
24233
24330
|
lx = _x - hw,
|
|
24234
24331
|
rx = _x + hw,
|
|
@@ -24247,29 +24344,40 @@
|
|
|
24247
24344
|
context.bezierCurveTo(rx, ymax, xmax, by, _x, by);
|
|
24248
24345
|
context.bezierCurveTo(xmin, by, lx, ymax, lx, _y);
|
|
24249
24346
|
context.bezierCurveTo(lx, ymin, xmin, ty, _x, ty);
|
|
24250
|
-
} else if (mask instanceof RoundRect) {
|
|
24251
|
-
context.roundRect(_x, _y, mask.width, mask.height, mask.radius);
|
|
24252
24347
|
} else {
|
|
24253
|
-
|
|
24348
|
+
var _x$1 = mask.pos.x, _y$1 = mask.pos.y;
|
|
24254
24349
|
var point;
|
|
24350
|
+
|
|
24351
|
+
context.moveTo(_x$1 + mask.points[0].x, _y$1 + mask.points[0].y);
|
|
24255
24352
|
for (var i = 1; i < mask.points.length; i++) {
|
|
24256
24353
|
point = mask.points[i];
|
|
24257
|
-
context.lineTo(_x + point.x, _y + point.y);
|
|
24354
|
+
context.lineTo(_x$1 + point.x, _y$1 + point.y);
|
|
24258
24355
|
}
|
|
24259
24356
|
}
|
|
24260
24357
|
|
|
24261
|
-
|
|
24358
|
+
this.maskLevel++;
|
|
24359
|
+
|
|
24360
|
+
if (invert === true) {
|
|
24361
|
+
context.closePath();
|
|
24362
|
+
context.globalCompositeOperation = "destination-atop";
|
|
24363
|
+
context.fill();
|
|
24364
|
+
} else {
|
|
24365
|
+
context.clip();
|
|
24366
|
+
}
|
|
24262
24367
|
};
|
|
24263
24368
|
|
|
24264
24369
|
/**
|
|
24265
24370
|
* disable (remove) the rendering mask set through setMask.
|
|
24266
24371
|
* @name clearMask
|
|
24267
24372
|
* @see CanvasRenderer#setMask
|
|
24268
|
-
* @memberof CanvasRenderer
|
|
24373
|
+
* @memberof CanvasRenderer
|
|
24269
24374
|
* @function
|
|
24270
24375
|
*/
|
|
24271
24376
|
CanvasRenderer.prototype.clearMask = function clearMask () {
|
|
24272
|
-
this.
|
|
24377
|
+
if (this.maskLevel > 0) {
|
|
24378
|
+
this.maskLevel = 0;
|
|
24379
|
+
this.getContext().restore();
|
|
24380
|
+
}
|
|
24273
24381
|
};
|
|
24274
24382
|
|
|
24275
24383
|
return CanvasRenderer;
|
|
@@ -24711,7 +24819,7 @@
|
|
|
24711
24819
|
this.onResetEvent(vertices);
|
|
24712
24820
|
};
|
|
24713
24821
|
|
|
24714
|
-
var prototypeAccessors = { x: { configurable: true },y: { configurable: true },width: { configurable: true },height: { configurable: true },left: { configurable: true },right: { configurable: true },top: { configurable: true },bottom: { configurable: true },centerX: { configurable: true },centerY: { configurable: true },center: { configurable: true } };
|
|
24822
|
+
var prototypeAccessors$1 = { x: { configurable: true },y: { configurable: true },width: { configurable: true },height: { configurable: true },left: { configurable: true },right: { configurable: true },top: { configurable: true },bottom: { configurable: true },centerX: { configurable: true },centerY: { configurable: true },center: { configurable: true } };
|
|
24715
24823
|
|
|
24716
24824
|
/**
|
|
24717
24825
|
* @ignore
|
|
@@ -24764,11 +24872,11 @@
|
|
|
24764
24872
|
* @name x
|
|
24765
24873
|
* @memberof Bounds
|
|
24766
24874
|
*/
|
|
24767
|
-
prototypeAccessors.x.get = function () {
|
|
24875
|
+
prototypeAccessors$1.x.get = function () {
|
|
24768
24876
|
return this.min.x;
|
|
24769
24877
|
};
|
|
24770
24878
|
|
|
24771
|
-
prototypeAccessors.x.set = function (value) {
|
|
24879
|
+
prototypeAccessors$1.x.set = function (value) {
|
|
24772
24880
|
var deltaX = this.max.x - this.min.x;
|
|
24773
24881
|
this.min.x = value;
|
|
24774
24882
|
this.max.x = value + deltaX;
|
|
@@ -24781,11 +24889,11 @@
|
|
|
24781
24889
|
* @name y
|
|
24782
24890
|
* @memberof Bounds
|
|
24783
24891
|
*/
|
|
24784
|
-
prototypeAccessors.y.get = function () {
|
|
24892
|
+
prototypeAccessors$1.y.get = function () {
|
|
24785
24893
|
return this.min.y;
|
|
24786
24894
|
};
|
|
24787
24895
|
|
|
24788
|
-
prototypeAccessors.y.set = function (value) {
|
|
24896
|
+
prototypeAccessors$1.y.set = function (value) {
|
|
24789
24897
|
var deltaY = this.max.y - this.min.y;
|
|
24790
24898
|
|
|
24791
24899
|
this.min.y = value;
|
|
@@ -24799,11 +24907,11 @@
|
|
|
24799
24907
|
* @name width
|
|
24800
24908
|
* @memberof Bounds
|
|
24801
24909
|
*/
|
|
24802
|
-
prototypeAccessors.width.get = function () {
|
|
24910
|
+
prototypeAccessors$1.width.get = function () {
|
|
24803
24911
|
return this.max.x - this.min.x;
|
|
24804
24912
|
};
|
|
24805
24913
|
|
|
24806
|
-
prototypeAccessors.width.set = function (value) {
|
|
24914
|
+
prototypeAccessors$1.width.set = function (value) {
|
|
24807
24915
|
this.max.x = this.min.x + value;
|
|
24808
24916
|
};
|
|
24809
24917
|
|
|
@@ -24814,11 +24922,11 @@
|
|
|
24814
24922
|
* @name width
|
|
24815
24923
|
* @memberof Bounds
|
|
24816
24924
|
*/
|
|
24817
|
-
prototypeAccessors.height.get = function () {
|
|
24925
|
+
prototypeAccessors$1.height.get = function () {
|
|
24818
24926
|
return this.max.y - this.min.y;
|
|
24819
24927
|
};
|
|
24820
24928
|
|
|
24821
|
-
prototypeAccessors.height.set = function (value) {
|
|
24929
|
+
prototypeAccessors$1.height.set = function (value) {
|
|
24822
24930
|
this.max.y = this.min.y + value;
|
|
24823
24931
|
};
|
|
24824
24932
|
|
|
@@ -24829,7 +24937,7 @@
|
|
|
24829
24937
|
* @name left
|
|
24830
24938
|
* @memberof Bounds
|
|
24831
24939
|
*/
|
|
24832
|
-
prototypeAccessors.left.get = function () {
|
|
24940
|
+
prototypeAccessors$1.left.get = function () {
|
|
24833
24941
|
return this.min.x;
|
|
24834
24942
|
};
|
|
24835
24943
|
|
|
@@ -24840,7 +24948,7 @@
|
|
|
24840
24948
|
* @name right
|
|
24841
24949
|
* @memberof Bounds
|
|
24842
24950
|
*/
|
|
24843
|
-
prototypeAccessors.right.get = function () {
|
|
24951
|
+
prototypeAccessors$1.right.get = function () {
|
|
24844
24952
|
return this.max.x;
|
|
24845
24953
|
};
|
|
24846
24954
|
|
|
@@ -24851,7 +24959,7 @@
|
|
|
24851
24959
|
* @name top
|
|
24852
24960
|
* @memberof Bounds
|
|
24853
24961
|
*/
|
|
24854
|
-
prototypeAccessors.top.get = function () {
|
|
24962
|
+
prototypeAccessors$1.top.get = function () {
|
|
24855
24963
|
return this.min.y;
|
|
24856
24964
|
};
|
|
24857
24965
|
|
|
@@ -24862,7 +24970,7 @@
|
|
|
24862
24970
|
* @name bottom
|
|
24863
24971
|
* @memberof Bounds
|
|
24864
24972
|
*/
|
|
24865
|
-
prototypeAccessors.bottom.get = function () {
|
|
24973
|
+
prototypeAccessors$1.bottom.get = function () {
|
|
24866
24974
|
return this.max.y;
|
|
24867
24975
|
};
|
|
24868
24976
|
|
|
@@ -24873,7 +24981,7 @@
|
|
|
24873
24981
|
* @name centerX
|
|
24874
24982
|
* @memberof Bounds
|
|
24875
24983
|
*/
|
|
24876
|
-
prototypeAccessors.centerX.get = function () {
|
|
24984
|
+
prototypeAccessors$1.centerX.get = function () {
|
|
24877
24985
|
return this.min.x + (this.width / 2);
|
|
24878
24986
|
};
|
|
24879
24987
|
|
|
@@ -24884,7 +24992,7 @@
|
|
|
24884
24992
|
* @name centerY
|
|
24885
24993
|
* @memberof Bounds
|
|
24886
24994
|
*/
|
|
24887
|
-
prototypeAccessors.centerY.get = function () {
|
|
24995
|
+
prototypeAccessors$1.centerY.get = function () {
|
|
24888
24996
|
return this.min.y + (this.height / 2);
|
|
24889
24997
|
};
|
|
24890
24998
|
|
|
@@ -24895,7 +25003,7 @@
|
|
|
24895
25003
|
* @name center
|
|
24896
25004
|
* @memberof Bounds
|
|
24897
25005
|
*/
|
|
24898
|
-
prototypeAccessors.center.get = function () {
|
|
25006
|
+
prototypeAccessors$1.center.get = function () {
|
|
24899
25007
|
return this._center.set(this.centerX, this.centerY);
|
|
24900
25008
|
};
|
|
24901
25009
|
|
|
@@ -25159,7 +25267,7 @@
|
|
|
25159
25267
|
]);
|
|
25160
25268
|
};
|
|
25161
25269
|
|
|
25162
|
-
Object.defineProperties( Bounds.prototype, prototypeAccessors );
|
|
25270
|
+
Object.defineProperties( Bounds.prototype, prototypeAccessors$1 );
|
|
25163
25271
|
|
|
25164
25272
|
/* eslint-disable no-unused-vars */
|
|
25165
25273
|
|
|
@@ -31547,8 +31655,8 @@
|
|
|
31547
31655
|
/**
|
|
31548
31656
|
* The WebGL context
|
|
31549
31657
|
* @name gl
|
|
31550
|
-
* @memberof WebGLRenderer
|
|
31551
|
-
* type {WebGLRenderingContext}
|
|
31658
|
+
* @memberof WebGLRenderer
|
|
31659
|
+
* @type {WebGLRenderingContext}
|
|
31552
31660
|
*/
|
|
31553
31661
|
this.context = this.gl = this.getContextGL(this.getScreenCanvas(), options.transparent);
|
|
31554
31662
|
|
|
@@ -31652,7 +31760,7 @@
|
|
|
31652
31760
|
/**
|
|
31653
31761
|
* Reset context state
|
|
31654
31762
|
* @name reset
|
|
31655
|
-
* @memberof WebGLRenderer
|
|
31763
|
+
* @memberof WebGLRenderer
|
|
31656
31764
|
* @function
|
|
31657
31765
|
*/
|
|
31658
31766
|
WebGLRenderer.prototype.reset = function reset () {
|
|
@@ -31681,7 +31789,7 @@
|
|
|
31681
31789
|
* @name setCompositor
|
|
31682
31790
|
* @function
|
|
31683
31791
|
* @param {WebGLCompositor|string} compositor a compositor name or instance
|
|
31684
|
-
* @memberof WebGLRenderer
|
|
31792
|
+
* @memberof WebGLRenderer
|
|
31685
31793
|
* @function
|
|
31686
31794
|
*/
|
|
31687
31795
|
WebGLRenderer.prototype.setCompositor = function setCompositor (compositor) {
|
|
@@ -31709,7 +31817,7 @@
|
|
|
31709
31817
|
/**
|
|
31710
31818
|
* Reset the gl transform to identity
|
|
31711
31819
|
* @name resetTransform
|
|
31712
|
-
* @memberof WebGLRenderer
|
|
31820
|
+
* @memberof WebGLRenderer
|
|
31713
31821
|
* @function
|
|
31714
31822
|
*/
|
|
31715
31823
|
WebGLRenderer.prototype.resetTransform = function resetTransform () {
|
|
@@ -31756,7 +31864,7 @@
|
|
|
31756
31864
|
/**
|
|
31757
31865
|
* Create a pattern with the specified repetition
|
|
31758
31866
|
* @name createPattern
|
|
31759
|
-
* @memberof WebGLRenderer
|
|
31867
|
+
* @memberof WebGLRenderer
|
|
31760
31868
|
* @function
|
|
31761
31869
|
* @param {Image} image Source image
|
|
31762
31870
|
* @param {string} repeat Define how the pattern should be repeated
|
|
@@ -31789,7 +31897,7 @@
|
|
|
31789
31897
|
/**
|
|
31790
31898
|
* Flush the compositor to the frame buffer
|
|
31791
31899
|
* @name flush
|
|
31792
|
-
* @memberof WebGLRenderer
|
|
31900
|
+
* @memberof WebGLRenderer
|
|
31793
31901
|
* @function
|
|
31794
31902
|
*/
|
|
31795
31903
|
WebGLRenderer.prototype.flush = function flush () {
|
|
@@ -31799,7 +31907,7 @@
|
|
|
31799
31907
|
/**
|
|
31800
31908
|
* set/change the current projection matrix (WebGL only)
|
|
31801
31909
|
* @name setProjection
|
|
31802
|
-
* @memberof WebGLRenderer
|
|
31910
|
+
* @memberof WebGLRenderer
|
|
31803
31911
|
* @function
|
|
31804
31912
|
* @param {Matrix3d} matrix
|
|
31805
31913
|
*/
|
|
@@ -31811,7 +31919,7 @@
|
|
|
31811
31919
|
/**
|
|
31812
31920
|
* Clears the gl context with the given color.
|
|
31813
31921
|
* @name clearColor
|
|
31814
|
-
* @memberof WebGLRenderer
|
|
31922
|
+
* @memberof WebGLRenderer
|
|
31815
31923
|
* @function
|
|
31816
31924
|
* @param {Color|string} [color="#000000"] CSS color.
|
|
31817
31925
|
* @param {boolean} [opaque=false] Allow transparency [default] or clear the surface completely [true]
|
|
@@ -31842,7 +31950,7 @@
|
|
|
31842
31950
|
/**
|
|
31843
31951
|
* Erase the pixels in the given rectangular area by setting them to transparent black (rgba(0,0,0,0)).
|
|
31844
31952
|
* @name clearRect
|
|
31845
|
-
* @memberof WebGLRenderer
|
|
31953
|
+
* @memberof WebGLRenderer
|
|
31846
31954
|
* @function
|
|
31847
31955
|
* @param {number} x x axis of the coordinate for the rectangle starting point.
|
|
31848
31956
|
* @param {number} y y axis of the coordinate for the rectangle starting point.
|
|
@@ -31892,7 +32000,7 @@
|
|
|
31892
32000
|
/**
|
|
31893
32001
|
* Draw an image to the gl context
|
|
31894
32002
|
* @name drawImage
|
|
31895
|
-
* @memberof WebGLRenderer
|
|
32003
|
+
* @memberof WebGLRenderer
|
|
31896
32004
|
* @function
|
|
31897
32005
|
* @param {Image} image An element to draw into the context. The specification permits any canvas image source (CanvasImageSource), specifically, a CSSImageValue, an HTMLImageElement, an SVGImageElement, an HTMLVideoElement, an HTMLCanvasElement, an ImageBitmap, or an OffscreenCanvas.
|
|
31898
32006
|
* @param {number} sx The X coordinate of the top left corner of the sub-rectangle of the source image to draw into the destination context.
|
|
@@ -31945,7 +32053,7 @@
|
|
|
31945
32053
|
/**
|
|
31946
32054
|
* Draw a pattern within the given rectangle.
|
|
31947
32055
|
* @name drawPattern
|
|
31948
|
-
* @memberof WebGLRenderer
|
|
32056
|
+
* @memberof WebGLRenderer
|
|
31949
32057
|
* @function
|
|
31950
32058
|
* @param {TextureAtlas} pattern Pattern object
|
|
31951
32059
|
* @param {number} x
|
|
@@ -31963,7 +32071,7 @@
|
|
|
31963
32071
|
/**
|
|
31964
32072
|
* return a reference to the screen canvas corresponding WebGL Context
|
|
31965
32073
|
* @name getScreenContext
|
|
31966
|
-
* @memberof WebGLRenderer
|
|
32074
|
+
* @memberof WebGLRenderer
|
|
31967
32075
|
* @function
|
|
31968
32076
|
* @returns {WebGLRenderingContext}
|
|
31969
32077
|
*/
|
|
@@ -31974,7 +32082,7 @@
|
|
|
31974
32082
|
/**
|
|
31975
32083
|
* Returns the WebGL Context object of the given Canvas
|
|
31976
32084
|
* @name getContextGL
|
|
31977
|
-
* @memberof WebGLRenderer
|
|
32085
|
+
* @memberof WebGLRenderer
|
|
31978
32086
|
* @function
|
|
31979
32087
|
* @param {HTMLCanvasElement} canvas
|
|
31980
32088
|
* @param {boolean} [transparent=true] use false to disable transparency
|
|
@@ -32032,7 +32140,7 @@
|
|
|
32032
32140
|
* Returns the WebGLContext instance for the renderer
|
|
32033
32141
|
* return a reference to the system 2d Context
|
|
32034
32142
|
* @name getContext
|
|
32035
|
-
* @memberof WebGLRenderer
|
|
32143
|
+
* @memberof WebGLRenderer
|
|
32036
32144
|
* @function
|
|
32037
32145
|
* @returns {WebGLRenderingContext}
|
|
32038
32146
|
*/
|
|
@@ -32053,7 +32161,7 @@
|
|
|
32053
32161
|
* <img src="images/screen-blendmode.png" width="510"/> <br>
|
|
32054
32162
|
* @name setBlendMode
|
|
32055
32163
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/globalCompositeOperation
|
|
32056
|
-
* @memberof WebGLRenderer
|
|
32164
|
+
* @memberof WebGLRenderer
|
|
32057
32165
|
* @function
|
|
32058
32166
|
* @param {string} [mode="normal"] blend mode : "normal", "multiply", "lighter", "additive", "screen"
|
|
32059
32167
|
* @param {WebGLRenderingContext} [gl]
|
|
@@ -32107,7 +32215,7 @@
|
|
|
32107
32215
|
/**
|
|
32108
32216
|
* restores the canvas context
|
|
32109
32217
|
* @name restore
|
|
32110
|
-
* @memberof WebGLRenderer
|
|
32218
|
+
* @memberof WebGLRenderer
|
|
32111
32219
|
* @function
|
|
32112
32220
|
*/
|
|
32113
32221
|
WebGLRenderer.prototype.restore = function restore () {
|
|
@@ -32143,7 +32251,7 @@
|
|
|
32143
32251
|
/**
|
|
32144
32252
|
* saves the canvas context
|
|
32145
32253
|
* @name save
|
|
32146
|
-
* @memberof WebGLRenderer
|
|
32254
|
+
* @memberof WebGLRenderer
|
|
32147
32255
|
* @function
|
|
32148
32256
|
*/
|
|
32149
32257
|
WebGLRenderer.prototype.save = function save () {
|
|
@@ -32161,7 +32269,7 @@
|
|
|
32161
32269
|
/**
|
|
32162
32270
|
* rotates the uniform matrix
|
|
32163
32271
|
* @name rotate
|
|
32164
|
-
* @memberof WebGLRenderer
|
|
32272
|
+
* @memberof WebGLRenderer
|
|
32165
32273
|
* @function
|
|
32166
32274
|
* @param {number} angle in radians
|
|
32167
32275
|
*/
|
|
@@ -32172,7 +32280,7 @@
|
|
|
32172
32280
|
/**
|
|
32173
32281
|
* scales the uniform matrix
|
|
32174
32282
|
* @name scale
|
|
32175
|
-
* @memberof WebGLRenderer
|
|
32283
|
+
* @memberof WebGLRenderer
|
|
32176
32284
|
* @function
|
|
32177
32285
|
* @param {number} x
|
|
32178
32286
|
* @param {number} y
|
|
@@ -32193,7 +32301,7 @@
|
|
|
32193
32301
|
/**
|
|
32194
32302
|
* Set the global alpha
|
|
32195
32303
|
* @name setGlobalAlpha
|
|
32196
|
-
* @memberof WebGLRenderer
|
|
32304
|
+
* @memberof WebGLRenderer
|
|
32197
32305
|
* @function
|
|
32198
32306
|
* @param {number} alpha 0.0 to 1.0 values accepted.
|
|
32199
32307
|
*/
|
|
@@ -32204,7 +32312,7 @@
|
|
|
32204
32312
|
/**
|
|
32205
32313
|
* Return the global alpha
|
|
32206
32314
|
* @name getGlobalAlpha
|
|
32207
|
-
* @memberof WebGLRenderer
|
|
32315
|
+
* @memberof WebGLRenderer
|
|
32208
32316
|
* @function
|
|
32209
32317
|
* @returns {number} global alpha value
|
|
32210
32318
|
*/
|
|
@@ -32216,7 +32324,7 @@
|
|
|
32216
32324
|
* Set the current fill & stroke style color.
|
|
32217
32325
|
* By default, or upon reset, the value is set to #000000.
|
|
32218
32326
|
* @name setColor
|
|
32219
|
-
* @memberof WebGLRenderer
|
|
32327
|
+
* @memberof WebGLRenderer
|
|
32220
32328
|
* @function
|
|
32221
32329
|
* @param {Color|string} color css color string.
|
|
32222
32330
|
*/
|
|
@@ -32229,7 +32337,7 @@
|
|
|
32229
32337
|
/**
|
|
32230
32338
|
* Set the line width
|
|
32231
32339
|
* @name setLineWidth
|
|
32232
|
-
* @memberof WebGLRenderer
|
|
32340
|
+
* @memberof WebGLRenderer
|
|
32233
32341
|
* @function
|
|
32234
32342
|
* @param {number} width Line width
|
|
32235
32343
|
*/
|
|
@@ -32240,7 +32348,7 @@
|
|
|
32240
32348
|
/**
|
|
32241
32349
|
* Stroke an arc at the specified coordinates with given radius, start and end points
|
|
32242
32350
|
* @name strokeArc
|
|
32243
|
-
* @memberof WebGLRenderer
|
|
32351
|
+
* @memberof WebGLRenderer
|
|
32244
32352
|
* @function
|
|
32245
32353
|
* @param {number} x arc center point x-axis
|
|
32246
32354
|
* @param {number} y arc center point y-axis
|
|
@@ -32271,7 +32379,7 @@
|
|
|
32271
32379
|
/**
|
|
32272
32380
|
* Fill an arc at the specified coordinates with given radius, start and end points
|
|
32273
32381
|
* @name fillArc
|
|
32274
|
-
* @memberof WebGLRenderer
|
|
32382
|
+
* @memberof WebGLRenderer
|
|
32275
32383
|
* @function
|
|
32276
32384
|
* @param {number} x arc center point x-axis
|
|
32277
32385
|
* @param {number} y arc center point y-axis
|
|
@@ -32289,7 +32397,7 @@
|
|
|
32289
32397
|
/**
|
|
32290
32398
|
* Stroke an ellipse at the specified coordinates with given radius
|
|
32291
32399
|
* @name strokeEllipse
|
|
32292
|
-
* @memberof WebGLRenderer
|
|
32400
|
+
* @memberof WebGLRenderer
|
|
32293
32401
|
* @function
|
|
32294
32402
|
* @param {number} x ellipse center point x-axis
|
|
32295
32403
|
* @param {number} y ellipse center point y-axis
|
|
@@ -32317,7 +32425,7 @@
|
|
|
32317
32425
|
/**
|
|
32318
32426
|
* Fill an ellipse at the specified coordinates with given radius
|
|
32319
32427
|
* @name fillEllipse
|
|
32320
|
-
* @memberof WebGLRenderer
|
|
32428
|
+
* @memberof WebGLRenderer
|
|
32321
32429
|
* @function
|
|
32322
32430
|
* @param {number} x ellipse center point x-axis
|
|
32323
32431
|
* @param {number} y ellipse center point y-axis
|
|
@@ -32331,7 +32439,7 @@
|
|
|
32331
32439
|
/**
|
|
32332
32440
|
* Stroke a line of the given two points
|
|
32333
32441
|
* @name strokeLine
|
|
32334
|
-
* @memberof WebGLRenderer
|
|
32442
|
+
* @memberof WebGLRenderer
|
|
32335
32443
|
* @function
|
|
32336
32444
|
* @param {number} startX the start x coordinate
|
|
32337
32445
|
* @param {number} startY the start y coordinate
|
|
@@ -32353,7 +32461,7 @@
|
|
|
32353
32461
|
/**
|
|
32354
32462
|
* Fill a line of the given two points
|
|
32355
32463
|
* @name fillLine
|
|
32356
|
-
* @memberof WebGLRenderer
|
|
32464
|
+
* @memberof WebGLRenderer
|
|
32357
32465
|
* @function
|
|
32358
32466
|
* @param {number} startX the start x coordinate
|
|
32359
32467
|
* @param {number} startY the start y coordinate
|
|
@@ -32367,7 +32475,7 @@
|
|
|
32367
32475
|
/**
|
|
32368
32476
|
* Stroke a me.Polygon on the screen with a specified color
|
|
32369
32477
|
* @name strokePolygon
|
|
32370
|
-
* @memberof WebGLRenderer
|
|
32478
|
+
* @memberof WebGLRenderer
|
|
32371
32479
|
* @function
|
|
32372
32480
|
* @param {Polygon} poly the shape to draw
|
|
32373
32481
|
* @param {boolean} [fill=false] also fill the shape with the current color if true
|
|
@@ -32401,7 +32509,7 @@
|
|
|
32401
32509
|
/**
|
|
32402
32510
|
* Fill a me.Polygon on the screen
|
|
32403
32511
|
* @name fillPolygon
|
|
32404
|
-
* @memberof WebGLRenderer
|
|
32512
|
+
* @memberof WebGLRenderer
|
|
32405
32513
|
* @function
|
|
32406
32514
|
* @param {Polygon} poly the shape to draw
|
|
32407
32515
|
*/
|
|
@@ -32412,7 +32520,7 @@
|
|
|
32412
32520
|
/**
|
|
32413
32521
|
* Draw a stroke rectangle at the specified coordinates
|
|
32414
32522
|
* @name strokeRect
|
|
32415
|
-
* @memberof WebGLRenderer
|
|
32523
|
+
* @memberof WebGLRenderer
|
|
32416
32524
|
* @function
|
|
32417
32525
|
* @param {number} x
|
|
32418
32526
|
* @param {number} y
|
|
@@ -32439,7 +32547,7 @@
|
|
|
32439
32547
|
/**
|
|
32440
32548
|
* Draw a filled rectangle at the specified coordinates
|
|
32441
32549
|
* @name fillRect
|
|
32442
|
-
* @memberof WebGLRenderer
|
|
32550
|
+
* @memberof WebGLRenderer
|
|
32443
32551
|
* @function
|
|
32444
32552
|
* @param {number} x
|
|
32445
32553
|
* @param {number} y
|
|
@@ -32453,7 +32561,7 @@
|
|
|
32453
32561
|
/**
|
|
32454
32562
|
* Stroke a rounded rectangle at the specified coordinates
|
|
32455
32563
|
* @name strokeRoundRect
|
|
32456
|
-
* @memberof WebGLRenderer
|
|
32564
|
+
* @memberof WebGLRenderer
|
|
32457
32565
|
* @function
|
|
32458
32566
|
* @param {number} x
|
|
32459
32567
|
* @param {number} y
|
|
@@ -32482,7 +32590,7 @@
|
|
|
32482
32590
|
/**
|
|
32483
32591
|
* Draw a rounded filled rectangle at the specified coordinates
|
|
32484
32592
|
* @name fillRoundRect
|
|
32485
|
-
* @memberof WebGLRenderer
|
|
32593
|
+
* @memberof WebGLRenderer
|
|
32486
32594
|
* @function
|
|
32487
32595
|
* @param {number} x
|
|
32488
32596
|
* @param {number} y
|
|
@@ -32498,7 +32606,7 @@
|
|
|
32498
32606
|
* Reset (overrides) the renderer transformation matrix to the
|
|
32499
32607
|
* identity one, and then apply the given transformation matrix.
|
|
32500
32608
|
* @name setTransform
|
|
32501
|
-
* @memberof WebGLRenderer
|
|
32609
|
+
* @memberof WebGLRenderer
|
|
32502
32610
|
* @function
|
|
32503
32611
|
* @param {Matrix2d} mat2d Matrix to transform by
|
|
32504
32612
|
*/
|
|
@@ -32510,7 +32618,7 @@
|
|
|
32510
32618
|
/**
|
|
32511
32619
|
* Multiply given matrix into the renderer tranformation matrix
|
|
32512
32620
|
* @name transform
|
|
32513
|
-
* @memberof WebGLRenderer
|
|
32621
|
+
* @memberof WebGLRenderer
|
|
32514
32622
|
* @function
|
|
32515
32623
|
* @param {Matrix2d} mat2d Matrix to transform by
|
|
32516
32624
|
*/
|
|
@@ -32528,7 +32636,7 @@
|
|
|
32528
32636
|
/**
|
|
32529
32637
|
* Translates the uniform matrix by the given coordinates
|
|
32530
32638
|
* @name translate
|
|
32531
|
-
* @memberof WebGLRenderer
|
|
32639
|
+
* @memberof WebGLRenderer
|
|
32532
32640
|
* @function
|
|
32533
32641
|
* @param {number} x
|
|
32534
32642
|
* @param {number} y
|
|
@@ -32551,7 +32659,7 @@
|
|
|
32551
32659
|
* and restore it (with the restore() method) any time in the future.
|
|
32552
32660
|
* (<u>this is an experimental feature !</u>)
|
|
32553
32661
|
* @name clipRect
|
|
32554
|
-
* @memberof WebGLRenderer
|
|
32662
|
+
* @memberof WebGLRenderer
|
|
32555
32663
|
* @function
|
|
32556
32664
|
* @param {number} x
|
|
32557
32665
|
* @param {number} y
|
|
@@ -32599,31 +32707,48 @@
|
|
|
32599
32707
|
* So, if the renderable is larger than the mask, only the intersecting part of the renderable will be visible.
|
|
32600
32708
|
* Mask are not preserved through renderer context save and restore.
|
|
32601
32709
|
* @name setMask
|
|
32602
|
-
* @memberof WebGLRenderer
|
|
32710
|
+
* @memberof WebGLRenderer
|
|
32603
32711
|
* @function
|
|
32604
|
-
* @param {Rect|RoundRect|Polygon|Line|Ellipse} [mask]
|
|
32712
|
+
* @param {Rect|RoundRect|Polygon|Line|Ellipse} [mask] a shape defining the mask to be applied
|
|
32713
|
+
* @param {boolean} [invert=false] either the given shape should define what is visible (default) or the opposite
|
|
32605
32714
|
*/
|
|
32606
|
-
WebGLRenderer.prototype.setMask = function setMask (mask) {
|
|
32715
|
+
WebGLRenderer.prototype.setMask = function setMask (mask, invert) {
|
|
32716
|
+
if ( invert === void 0 ) invert = false;
|
|
32717
|
+
|
|
32607
32718
|
var gl = this.gl;
|
|
32608
32719
|
|
|
32609
32720
|
// flush the compositor
|
|
32610
32721
|
this.flush();
|
|
32611
32722
|
|
|
32612
|
-
|
|
32613
|
-
|
|
32614
|
-
|
|
32723
|
+
if (this.maskLevel === 0) {
|
|
32724
|
+
// Enable and setup GL state to write to stencil buffer
|
|
32725
|
+
gl.enable(gl.STENCIL_TEST);
|
|
32726
|
+
gl.clear(gl.STENCIL_BUFFER_BIT);
|
|
32727
|
+
|
|
32728
|
+
|
|
32729
|
+
}
|
|
32730
|
+
|
|
32731
|
+
this.maskLevel++;
|
|
32732
|
+
|
|
32615
32733
|
gl.colorMask(false, false, false, false);
|
|
32616
|
-
gl.stencilFunc(gl.
|
|
32734
|
+
gl.stencilFunc(gl.EQUAL, this.maskLevel, 1);
|
|
32617
32735
|
gl.stencilOp(gl.REPLACE, gl.REPLACE, gl.REPLACE);
|
|
32618
32736
|
|
|
32737
|
+
|
|
32738
|
+
// fill the given mask shape
|
|
32619
32739
|
this.fill(mask);
|
|
32620
32740
|
|
|
32621
32741
|
// flush the compositor
|
|
32622
32742
|
this.flush();
|
|
32623
32743
|
|
|
32624
|
-
// Use stencil buffer to affect next rendering object
|
|
32625
32744
|
gl.colorMask(true, true, true, true);
|
|
32626
|
-
|
|
32745
|
+
|
|
32746
|
+
// Use stencil buffer to affect next rendering object
|
|
32747
|
+
if (invert === true) {
|
|
32748
|
+
gl.stencilFunc(gl.EQUAL, this.maskLevel + 1, 1);
|
|
32749
|
+
} else {
|
|
32750
|
+
gl.stencilFunc(gl.NOTEQUAL, this.maskLevel + 1, 1);
|
|
32751
|
+
}
|
|
32627
32752
|
gl.stencilOp(gl.KEEP, gl.KEEP, gl.KEEP);
|
|
32628
32753
|
};
|
|
32629
32754
|
|
|
@@ -32631,13 +32756,16 @@
|
|
|
32631
32756
|
* disable (remove) the rendering mask set through setMask.
|
|
32632
32757
|
* @name clearMask
|
|
32633
32758
|
* @see WebGLRenderer#setMask
|
|
32634
|
-
* @memberof WebGLRenderer
|
|
32759
|
+
* @memberof WebGLRenderer
|
|
32635
32760
|
* @function
|
|
32636
32761
|
*/
|
|
32637
32762
|
WebGLRenderer.prototype.clearMask = function clearMask () {
|
|
32638
|
-
|
|
32639
|
-
|
|
32640
|
-
|
|
32763
|
+
if (this.maskLevel > 0) {
|
|
32764
|
+
// flush the compositor
|
|
32765
|
+
this.flush();
|
|
32766
|
+
this.maskLevel = 0;
|
|
32767
|
+
this.gl.disable(this.gl.STENCIL_TEST);
|
|
32768
|
+
}
|
|
32641
32769
|
};
|
|
32642
32770
|
|
|
32643
32771
|
return WebGLRenderer;
|
|
@@ -33840,10 +33968,10 @@
|
|
|
33840
33968
|
* this can be overridden by the plugin
|
|
33841
33969
|
* @public
|
|
33842
33970
|
* @type {string}
|
|
33843
|
-
* @default "10.
|
|
33971
|
+
* @default "10.10.0"
|
|
33844
33972
|
* @name plugin.Base#version
|
|
33845
33973
|
*/
|
|
33846
|
-
this.version = "10.
|
|
33974
|
+
this.version = "10.10.0";
|
|
33847
33975
|
};
|
|
33848
33976
|
|
|
33849
33977
|
/**
|
|
@@ -34853,6 +34981,89 @@
|
|
|
34853
34981
|
|
|
34854
34982
|
Object.defineProperties( Tween, staticAccessors );
|
|
34855
34983
|
|
|
34984
|
+
/**
|
|
34985
|
+
* Creates a Canvas Texture of the given size
|
|
34986
|
+
*/
|
|
34987
|
+
var CanvasTexture = function CanvasTexture(width, height, offscreenCanvas) {
|
|
34988
|
+
if ( offscreenCanvas === void 0 ) offscreenCanvas = true;
|
|
34989
|
+
|
|
34990
|
+
/**
|
|
34991
|
+
* the canvas created for this CanvasTexture
|
|
34992
|
+
* @type {HTMLCanvasElement|OffscreenCanvas}
|
|
34993
|
+
*/
|
|
34994
|
+
this.canvas = createCanvas(width, height, offscreenCanvas);
|
|
34995
|
+
|
|
34996
|
+
/**
|
|
34997
|
+
* the rendering context of this CanvasTexture
|
|
34998
|
+
* @type {CanvasRenderingContext2D}
|
|
34999
|
+
*/
|
|
35000
|
+
this.context = this.canvas.getContext("2d");
|
|
35001
|
+
};
|
|
35002
|
+
|
|
35003
|
+
var prototypeAccessors = { width: { configurable: true },height: { configurable: true } };
|
|
35004
|
+
|
|
35005
|
+
/**
|
|
35006
|
+
* @ignore
|
|
35007
|
+
*/
|
|
35008
|
+
CanvasTexture.prototype.onResetEvent = function onResetEvent (width, height) {
|
|
35009
|
+
this.clear();
|
|
35010
|
+
this.resize(width, height);
|
|
35011
|
+
};
|
|
35012
|
+
|
|
35013
|
+
/**
|
|
35014
|
+
* Clears the content of the canvas texture
|
|
35015
|
+
*/
|
|
35016
|
+
CanvasTexture.prototype.clear = function clear () {
|
|
35017
|
+
this.context.setTransform(1, 0, 0, 1, 0, 0);
|
|
35018
|
+
this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);
|
|
35019
|
+
};
|
|
35020
|
+
|
|
35021
|
+
/**
|
|
35022
|
+
* Resizes the canvas texture to the given width and height.
|
|
35023
|
+
* @param {number} width the desired width
|
|
35024
|
+
* @param {number} height the desired height
|
|
35025
|
+
*/
|
|
35026
|
+
CanvasTexture.prototype.resize = function resize (width, height) {
|
|
35027
|
+
this.canvas.width = Math.round(width);
|
|
35028
|
+
this.canvas.height = Math.round(height);
|
|
35029
|
+
};
|
|
35030
|
+
|
|
35031
|
+
/**
|
|
35032
|
+
* @ignore
|
|
35033
|
+
*/
|
|
35034
|
+
CanvasTexture.prototype.destroy = function destroy () {
|
|
35035
|
+
this.context = undefined;
|
|
35036
|
+
this.canvas = undefined;
|
|
35037
|
+
};
|
|
35038
|
+
|
|
35039
|
+
/**
|
|
35040
|
+
* The width of this canvas texture in pixels
|
|
35041
|
+
* @public
|
|
35042
|
+
* @type {number}
|
|
35043
|
+
*/
|
|
35044
|
+
prototypeAccessors.width.get = function () {
|
|
35045
|
+
return this.canvas.width;
|
|
35046
|
+
};
|
|
35047
|
+
|
|
35048
|
+
prototypeAccessors.width.set = function (val) {
|
|
35049
|
+
this.canvas.width = Math.round(val);
|
|
35050
|
+
};
|
|
35051
|
+
|
|
35052
|
+
/**
|
|
35053
|
+
* The height of this canvas texture in pixels
|
|
35054
|
+
* @public
|
|
35055
|
+
* @type {number}
|
|
35056
|
+
*/
|
|
35057
|
+
prototypeAccessors.height.get = function () {
|
|
35058
|
+
return this.canvas.height;
|
|
35059
|
+
};
|
|
35060
|
+
|
|
35061
|
+
prototypeAccessors.height.set = function (val) {
|
|
35062
|
+
this.canvas.height = Math.round(val);
|
|
35063
|
+
};
|
|
35064
|
+
|
|
35065
|
+
Object.defineProperties( CanvasTexture.prototype, prototypeAccessors );
|
|
35066
|
+
|
|
34856
35067
|
/**
|
|
34857
35068
|
* apply the current text style to the given context
|
|
34858
35069
|
* @ignore
|
|
@@ -35048,7 +35259,7 @@
|
|
|
35048
35259
|
// return a valid 2d context for Text rendering/styling
|
|
35049
35260
|
var getContext2d = function (renderer, text) {
|
|
35050
35261
|
if (text.offScreenCanvas === true) {
|
|
35051
|
-
return text.context;
|
|
35262
|
+
return text.canvasTexture.context;
|
|
35052
35263
|
} else {
|
|
35053
35264
|
return renderer.getFontContext();
|
|
35054
35265
|
}
|
|
@@ -35200,8 +35411,7 @@
|
|
|
35200
35411
|
|
|
35201
35412
|
if (settings.offScreenCanvas === true) {
|
|
35202
35413
|
this.offScreenCanvas = true;
|
|
35203
|
-
this.
|
|
35204
|
-
this.context = this.canvas.getContext("2d");
|
|
35414
|
+
this.canvasTexture = pool$1.pull("CanvasTexture", 2, 2, true);
|
|
35205
35415
|
}
|
|
35206
35416
|
|
|
35207
35417
|
// instance to text metrics functions
|
|
@@ -35216,10 +35426,9 @@
|
|
|
35216
35426
|
// free the canvas and potential corresponding texture when deactivated
|
|
35217
35427
|
if (this.offScreenCanvas === true) {
|
|
35218
35428
|
renderer.currentCompositor.deleteTexture2D(renderer.currentCompositor.getTexture2D(this.glTextureUnit));
|
|
35219
|
-
renderer.cache.delete(this.canvas);
|
|
35220
|
-
|
|
35221
|
-
this.
|
|
35222
|
-
this.canvas = undefined;
|
|
35429
|
+
renderer.cache.delete(this.canvasTexture.canvas);
|
|
35430
|
+
pool$1.push(this.canvasTexture);
|
|
35431
|
+
this.canvasTexture = undefined;
|
|
35223
35432
|
this.glTextureUnit = undefined;
|
|
35224
35433
|
}
|
|
35225
35434
|
};
|
|
@@ -35321,7 +35530,7 @@
|
|
|
35321
35530
|
|
|
35322
35531
|
if (renderer instanceof WebGLRenderer) {
|
|
35323
35532
|
// invalidate the previous corresponding texture so that it can reuploaded once changed
|
|
35324
|
-
this.glTextureUnit = renderer.cache.getUnit(renderer.cache.get(this.canvas));
|
|
35533
|
+
this.glTextureUnit = renderer.cache.getUnit(renderer.cache.get(this.canvasTexture.canvas));
|
|
35325
35534
|
renderer.currentCompositor.unbindTexture2D(null, this.glTextureUnit);
|
|
35326
35535
|
|
|
35327
35536
|
if (renderer.WebGLVersion === 1) {
|
|
@@ -35332,14 +35541,12 @@
|
|
|
35332
35541
|
}
|
|
35333
35542
|
|
|
35334
35543
|
// resize the cache canvas if necessary
|
|
35335
|
-
if (this.
|
|
35336
|
-
this.
|
|
35337
|
-
this.canvas.height = height;
|
|
35338
|
-
// resizing the canvas will automatically clear its content
|
|
35339
|
-
} else {
|
|
35340
|
-
this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);
|
|
35544
|
+
if (this.canvasTexture.width < width || this.canvasTexture.height < height) {
|
|
35545
|
+
this.canvasTexture.resize(width, height);
|
|
35341
35546
|
}
|
|
35342
|
-
|
|
35547
|
+
|
|
35548
|
+
this.canvasTexture.clear();
|
|
35549
|
+
this._drawFont(this.canvasTexture.context, this._text, this.pos.x - this.metrics.x, this.pos.y - this.metrics.y, false);
|
|
35343
35550
|
}
|
|
35344
35551
|
|
|
35345
35552
|
this.isDirty = true;
|
|
@@ -35406,7 +35613,7 @@
|
|
|
35406
35613
|
|
|
35407
35614
|
// draw the text
|
|
35408
35615
|
if (this.offScreenCanvas === true) {
|
|
35409
|
-
renderer.drawImage(this.canvas, x, y);
|
|
35616
|
+
renderer.drawImage(this.canvasTexture.canvas, x, y);
|
|
35410
35617
|
} else {
|
|
35411
35618
|
renderer.drawFont(this._drawFont(renderer.getFontContext(), this._text, x, y, stroke));
|
|
35412
35619
|
}
|
|
@@ -36237,7 +36444,7 @@
|
|
|
36237
36444
|
/**
|
|
36238
36445
|
* resize the Image Layer to match the given size
|
|
36239
36446
|
* @name resize
|
|
36240
|
-
* @memberof ImageLayer
|
|
36447
|
+
* @memberof ImageLayer
|
|
36241
36448
|
* @function
|
|
36242
36449
|
* @param {number} w new width
|
|
36243
36450
|
* @param {number} h new height
|
|
@@ -36327,7 +36534,7 @@
|
|
|
36327
36534
|
* draw the ImageLayer. <br>
|
|
36328
36535
|
* automatically called by the game manager {@link game}
|
|
36329
36536
|
* @name draw
|
|
36330
|
-
* @memberof ImageLayer
|
|
36537
|
+
* @memberof ImageLayer
|
|
36331
36538
|
* @function
|
|
36332
36539
|
* @protected
|
|
36333
36540
|
* @param {CanvasRenderer|WebGLRenderer} renderer a renderer object
|
|
@@ -36659,7 +36866,7 @@
|
|
|
36659
36866
|
/**
|
|
36660
36867
|
* function called when the object is pressed (to be extended)
|
|
36661
36868
|
* @name onClick
|
|
36662
|
-
* @memberof GUI_Object
|
|
36869
|
+
* @memberof GUI_Object
|
|
36663
36870
|
* @public
|
|
36664
36871
|
* @function
|
|
36665
36872
|
* @param {Pointer} event the event object
|
|
@@ -36682,7 +36889,7 @@
|
|
|
36682
36889
|
/**
|
|
36683
36890
|
* function called when the pointer is over the object
|
|
36684
36891
|
* @name onOver
|
|
36685
|
-
* @memberof GUI_Object
|
|
36892
|
+
* @memberof GUI_Object
|
|
36686
36893
|
* @public
|
|
36687
36894
|
* @function
|
|
36688
36895
|
* @param {Pointer} event the event object
|
|
@@ -36703,7 +36910,7 @@
|
|
|
36703
36910
|
/**
|
|
36704
36911
|
* function called when the pointer is leaving the object area
|
|
36705
36912
|
* @name onOut
|
|
36706
|
-
* @memberof GUI_Object
|
|
36913
|
+
* @memberof GUI_Object
|
|
36707
36914
|
* @public
|
|
36708
36915
|
* @function
|
|
36709
36916
|
* @param {Pointer} event the event object
|
|
@@ -36728,7 +36935,7 @@
|
|
|
36728
36935
|
/**
|
|
36729
36936
|
* function called when the object is pressed and released (to be extended)
|
|
36730
36937
|
* @name onRelease
|
|
36731
|
-
* @memberof GUI_Object
|
|
36938
|
+
* @memberof GUI_Object
|
|
36732
36939
|
* @public
|
|
36733
36940
|
* @function
|
|
36734
36941
|
* @returns {boolean} return false if we need to stop propagating the event
|
|
@@ -36753,7 +36960,7 @@
|
|
|
36753
36960
|
* function called when the object is pressed and held<br>
|
|
36754
36961
|
* to be extended <br>
|
|
36755
36962
|
* @name onHold
|
|
36756
|
-
* @memberof GUI_Object
|
|
36963
|
+
* @memberof GUI_Object
|
|
36757
36964
|
* @public
|
|
36758
36965
|
* @function
|
|
36759
36966
|
*/
|
|
@@ -36952,6 +37159,120 @@
|
|
|
36952
37159
|
return Trigger;
|
|
36953
37160
|
}(Renderable));
|
|
36954
37161
|
|
|
37162
|
+
/** @ignore */
|
|
37163
|
+
function createGradient(light) {
|
|
37164
|
+
var context = light.texture.context;
|
|
37165
|
+
var x1 = light.texture.width / 2;
|
|
37166
|
+
var y1 = light.texture.height / 2;
|
|
37167
|
+
var gradient = context.createRadialGradient(x1, y1, 0, x1, y1, light.radius);
|
|
37168
|
+
|
|
37169
|
+
light.texture.clear();
|
|
37170
|
+
|
|
37171
|
+
gradient.addColorStop( 0, light.color.toRGBA(light.intensity));
|
|
37172
|
+
gradient.addColorStop( 1, light.color.toRGBA(0.0));
|
|
37173
|
+
|
|
37174
|
+
context.beginPath();
|
|
37175
|
+
context.fillStyle = gradient;
|
|
37176
|
+
context.arc(x1, y1, light.radius, 0, Math.PI * 2, false);
|
|
37177
|
+
context.fill();
|
|
37178
|
+
}
|
|
37179
|
+
|
|
37180
|
+
/**
|
|
37181
|
+
* @classdesc
|
|
37182
|
+
* A 2D point light.
|
|
37183
|
+
* Note: this is a very experimental and work in progress feature, that provides a simple spot light effect.
|
|
37184
|
+
* The light effect is best rendered in WebGL, as they are few limitations when using the Canvas Renderer
|
|
37185
|
+
* (multiple lights are not supported, alpha component of the ambient light is ignored)
|
|
37186
|
+
* @see stage.lights
|
|
37187
|
+
*/
|
|
37188
|
+
var Light2d = /*@__PURE__*/(function (Renderable) {
|
|
37189
|
+
function Light2d(x, y, radius, color, intensity) {
|
|
37190
|
+
if ( color === void 0 ) color = "#FFF";
|
|
37191
|
+
if ( intensity === void 0 ) intensity = 0.7;
|
|
37192
|
+
|
|
37193
|
+
// call the parent constructor
|
|
37194
|
+
Renderable.call(this, x, y, radius * 2, radius * 2);
|
|
37195
|
+
|
|
37196
|
+
/**
|
|
37197
|
+
* the color of the light
|
|
37198
|
+
* @type {Color}
|
|
37199
|
+
* @default "#FFF"
|
|
37200
|
+
*/
|
|
37201
|
+
this.color = pool$1.pull("Color").parseCSS(color);
|
|
37202
|
+
|
|
37203
|
+
/**
|
|
37204
|
+
* The radius of the light
|
|
37205
|
+
* @type {number}
|
|
37206
|
+
*/
|
|
37207
|
+
this.radius = radius;
|
|
37208
|
+
|
|
37209
|
+
/**
|
|
37210
|
+
* The intensity of the light
|
|
37211
|
+
* @type {number}
|
|
37212
|
+
* @default 0.7
|
|
37213
|
+
*/
|
|
37214
|
+
this.intensity = intensity;
|
|
37215
|
+
|
|
37216
|
+
/**
|
|
37217
|
+
* the default blend mode to be applied when rendering this light
|
|
37218
|
+
* @type {string}
|
|
37219
|
+
* @default "lighter"
|
|
37220
|
+
* @see CanvasRenderer#setBlendMode
|
|
37221
|
+
* @see WebGLRenderer#setBlendMode
|
|
37222
|
+
*/
|
|
37223
|
+
this.blendMode = "lighter";
|
|
37224
|
+
|
|
37225
|
+
/** @ignore */
|
|
37226
|
+
this.visibleArea = pool$1.pull("Ellipse", this.centerX, this.centerY, this.width, this.height);
|
|
37227
|
+
|
|
37228
|
+
/** @ignore */
|
|
37229
|
+
this.texture = pool$1.pull("CanvasTexture", this.width, this.height, false);
|
|
37230
|
+
|
|
37231
|
+
this.anchorPoint.set(0, 0);
|
|
37232
|
+
|
|
37233
|
+
createGradient(this);
|
|
37234
|
+
}
|
|
37235
|
+
|
|
37236
|
+
if ( Renderable ) Light2d.__proto__ = Renderable;
|
|
37237
|
+
Light2d.prototype = Object.create( Renderable && Renderable.prototype );
|
|
37238
|
+
Light2d.prototype.constructor = Light2d;
|
|
37239
|
+
|
|
37240
|
+
/**
|
|
37241
|
+
* returns a geometry representing the visible area of this light
|
|
37242
|
+
* @name getVisibleArea
|
|
37243
|
+
* @memberof Light2d
|
|
37244
|
+
* @function
|
|
37245
|
+
* @returns {Ellipse} the light visible mask
|
|
37246
|
+
*/
|
|
37247
|
+
Light2d.prototype.getVisibleArea = function getVisibleArea () {
|
|
37248
|
+
return this.visibleArea.setShape(this.getBounds().centerX, this.getBounds().centerY, this.width, this.height);
|
|
37249
|
+
};
|
|
37250
|
+
|
|
37251
|
+
/**
|
|
37252
|
+
* object draw (Called internally by the engine).
|
|
37253
|
+
* @ignore
|
|
37254
|
+
*/
|
|
37255
|
+
Light2d.prototype.draw = function draw (renderer) {
|
|
37256
|
+
renderer.drawImage(this.texture.canvas, this.getBounds().x, this.getBounds().y);
|
|
37257
|
+
};
|
|
37258
|
+
|
|
37259
|
+
/**
|
|
37260
|
+
* Destroy function<br>
|
|
37261
|
+
* @ignore
|
|
37262
|
+
*/
|
|
37263
|
+
Light2d.prototype.destroy = function destroy () {
|
|
37264
|
+
pool$1.push(this.color);
|
|
37265
|
+
this.color = undefined;
|
|
37266
|
+
pool$1.push(this.texture);
|
|
37267
|
+
this.texture = undefined;
|
|
37268
|
+
pool$1.push(this.visibleArea);
|
|
37269
|
+
this.visibleArea = undefined;
|
|
37270
|
+
Renderable.prototype.destroy.call(this);
|
|
37271
|
+
};
|
|
37272
|
+
|
|
37273
|
+
return Light2d;
|
|
37274
|
+
}(Renderable));
|
|
37275
|
+
|
|
36955
37276
|
/**
|
|
36956
37277
|
* @classdesc
|
|
36957
37278
|
* A Draggable base object
|
|
@@ -37482,9 +37803,6 @@
|
|
|
37482
37803
|
framesToSkip : 0
|
|
37483
37804
|
};
|
|
37484
37805
|
|
|
37485
|
-
// default texture used when no sprite is defined
|
|
37486
|
-
var defaultParticleTexture;
|
|
37487
|
-
|
|
37488
37806
|
/**
|
|
37489
37807
|
* @ignore
|
|
37490
37808
|
*/
|
|
@@ -37492,12 +37810,11 @@
|
|
|
37492
37810
|
if ( w === void 0 ) w = 8;
|
|
37493
37811
|
if ( h === void 0 ) h = 8;
|
|
37494
37812
|
|
|
37495
|
-
|
|
37496
|
-
|
|
37497
|
-
|
|
37498
|
-
|
|
37499
|
-
|
|
37500
|
-
}
|
|
37813
|
+
var defaultParticleTexture = pool$1.pull("CanvasTexture", w, h, true);
|
|
37814
|
+
|
|
37815
|
+
defaultParticleTexture.context.fillStyle = "#fff";
|
|
37816
|
+
defaultParticleTexture.context.fillRect(0, 0, w, h);
|
|
37817
|
+
|
|
37501
37818
|
return defaultParticleTexture;
|
|
37502
37819
|
}
|
|
37503
37820
|
/**
|
|
@@ -37577,9 +37894,9 @@
|
|
|
37577
37894
|
|
|
37578
37895
|
Object.assign(this.settings, ParticleEmitterSettings, settings);
|
|
37579
37896
|
|
|
37580
|
-
// Cache the image reference
|
|
37581
37897
|
if (typeof this.settings.image === "undefined") {
|
|
37582
|
-
this.
|
|
37898
|
+
this._defaultParticle = createDefaultParticleTexture(settings.textureSize, settings.textureSize);
|
|
37899
|
+
this.settings.image = this._defaultParticle.canvas;
|
|
37583
37900
|
}
|
|
37584
37901
|
|
|
37585
37902
|
this.floating = this.settings.floating;
|
|
@@ -37709,6 +38026,10 @@
|
|
|
37709
38026
|
// call the parent destroy method
|
|
37710
38027
|
Container.prototype.destroy.call(this, arguments);
|
|
37711
38028
|
// clean emitter specific Properties
|
|
38029
|
+
if (typeof this._defaultParticle !== "undefined") {
|
|
38030
|
+
pool$1.push(this._defaultParticle);
|
|
38031
|
+
this._defaultParticle = undefined;
|
|
38032
|
+
}
|
|
37712
38033
|
this.settings.image = undefined;
|
|
37713
38034
|
this.settings = undefined;
|
|
37714
38035
|
};
|
|
@@ -38167,9 +38488,10 @@
|
|
|
38167
38488
|
}
|
|
38168
38489
|
/**
|
|
38169
38490
|
* @public
|
|
38170
|
-
* @type {Function}
|
|
38171
38491
|
* @name turnOnPointerLock
|
|
38172
|
-
* @
|
|
38492
|
+
* @function
|
|
38493
|
+
* @returns {boolean} return true if the request was successfully submitted
|
|
38494
|
+
* @memberof device#
|
|
38173
38495
|
* @deprecated since 10.3.0
|
|
38174
38496
|
* @see input.requestPointerLock
|
|
38175
38497
|
*/
|
|
@@ -38180,9 +38502,10 @@
|
|
|
38180
38502
|
|
|
38181
38503
|
/**
|
|
38182
38504
|
* @public
|
|
38183
|
-
* @type {Function}
|
|
38184
38505
|
* @name turnOffPointerLock
|
|
38185
|
-
* @
|
|
38506
|
+
* @function
|
|
38507
|
+
* @returns {boolean} return true if the request was successfully submitted
|
|
38508
|
+
* @memberof device#
|
|
38186
38509
|
* @deprecated since 10.3.0
|
|
38187
38510
|
* @see input.exitPointerLock
|
|
38188
38511
|
*/
|
|
@@ -38259,7 +38582,7 @@
|
|
|
38259
38582
|
* @name version
|
|
38260
38583
|
* @type {string}
|
|
38261
38584
|
*/
|
|
38262
|
-
var version = "10.
|
|
38585
|
+
var version = "10.10.0";
|
|
38263
38586
|
|
|
38264
38587
|
|
|
38265
38588
|
/**
|
|
@@ -38297,6 +38620,7 @@
|
|
|
38297
38620
|
pool$1.register("me.Entity", Entity);
|
|
38298
38621
|
pool$1.register("me.Collectable", Collectable);
|
|
38299
38622
|
pool$1.register("me.Trigger", Trigger);
|
|
38623
|
+
pool$1.register("me.Light2d", Light2d);
|
|
38300
38624
|
pool$1.register("me.Tween", Tween, true);
|
|
38301
38625
|
pool$1.register("me.Color", Color, true);
|
|
38302
38626
|
pool$1.register("me.Particle", Particle, true);
|
|
@@ -38314,7 +38638,7 @@
|
|
|
38314
38638
|
pool$1.register("me.ObservableVector3d", ObservableVector3d, true);
|
|
38315
38639
|
pool$1.register("me.Matrix2d", Matrix2d, true);
|
|
38316
38640
|
pool$1.register("me.Matrix3d", Matrix3d, true);
|
|
38317
|
-
pool$1.register("me.Rect", Rect, true);
|
|
38641
|
+
pool$1.register("me.Rect", Rect$1, true);
|
|
38318
38642
|
pool$1.register("me.RoundRect", RoundRect, true);
|
|
38319
38643
|
pool$1.register("me.Polygon", Polygon, true);
|
|
38320
38644
|
pool$1.register("me.Line", Line, true);
|
|
@@ -38325,6 +38649,7 @@
|
|
|
38325
38649
|
pool$1.register("Entity", Entity);
|
|
38326
38650
|
pool$1.register("Collectable", Collectable);
|
|
38327
38651
|
pool$1.register("Trigger", Trigger);
|
|
38652
|
+
pool$1.register("Light2d", Light2d);
|
|
38328
38653
|
pool$1.register("Tween", Tween, true);
|
|
38329
38654
|
pool$1.register("Color", Color, true);
|
|
38330
38655
|
pool$1.register("Particle", Particle, true);
|
|
@@ -38342,12 +38667,13 @@
|
|
|
38342
38667
|
pool$1.register("ObservableVector3d", ObservableVector3d, true);
|
|
38343
38668
|
pool$1.register("Matrix2d", Matrix2d, true);
|
|
38344
38669
|
pool$1.register("Matrix3d", Matrix3d, true);
|
|
38345
|
-
pool$1.register("Rect", Rect, true);
|
|
38670
|
+
pool$1.register("Rect", Rect$1, true);
|
|
38346
38671
|
pool$1.register("RoundRect", RoundRect, true);
|
|
38347
38672
|
pool$1.register("Polygon", Polygon, true);
|
|
38348
38673
|
pool$1.register("Line", Line, true);
|
|
38349
38674
|
pool$1.register("Ellipse", Ellipse, true);
|
|
38350
38675
|
pool$1.register("Bounds", Bounds$1, true);
|
|
38676
|
+
pool$1.register("CanvasTexture", CanvasTexture, true);
|
|
38351
38677
|
|
|
38352
38678
|
// publish Boot notification
|
|
38353
38679
|
emit(BOOT);
|
|
@@ -38387,6 +38713,7 @@
|
|
|
38387
38713
|
exports.GLShader = GLShader;
|
|
38388
38714
|
exports.GUI_Object = GUI_Object;
|
|
38389
38715
|
exports.ImageLayer = ImageLayer;
|
|
38716
|
+
exports.Light2d = Light2d;
|
|
38390
38717
|
exports.Line = Line;
|
|
38391
38718
|
exports.Math = math;
|
|
38392
38719
|
exports.Matrix2d = Matrix2d;
|
|
@@ -38400,7 +38727,7 @@
|
|
|
38400
38727
|
exports.Pointer = Pointer;
|
|
38401
38728
|
exports.Polygon = Polygon;
|
|
38402
38729
|
exports.QuadTree = QuadTree;
|
|
38403
|
-
exports.Rect = Rect;
|
|
38730
|
+
exports.Rect = Rect$1;
|
|
38404
38731
|
exports.Renderable = Renderable;
|
|
38405
38732
|
exports.Renderer = Renderer;
|
|
38406
38733
|
exports.RoundRect = RoundRect;
|