melonjs 13.3.0 → 13.4.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/dist/melonjs.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * melonJS Game Engine - v13.3.0
2
+ * melonJS Game Engine - v13.4.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
@@ -19,7 +19,7 @@
19
19
 
20
20
  // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
21
21
  var global$c =
22
- // eslint-disable-next-line es-x/no-global-this -- safe
22
+ // eslint-disable-next-line es/no-global-this -- safe
23
23
  check(typeof globalThis == 'object' && globalThis) ||
24
24
  check(typeof window == 'object' && window) ||
25
25
  // eslint-disable-next-line no-restricted-globals -- safe
@@ -42,14 +42,14 @@
42
42
 
43
43
  // Detect IE8's incomplete defineProperty implementation
44
44
  var descriptors = !fails$8(function () {
45
- // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
45
+ // eslint-disable-next-line es/no-object-defineproperty -- required for testing
46
46
  return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
47
47
  });
48
48
 
49
49
  var fails$7 = fails$9;
50
50
 
51
51
  var functionBindNative = !fails$7(function () {
52
- // eslint-disable-next-line es-x/no-function-prototype-bind -- safe
52
+ // eslint-disable-next-line es/no-function-prototype-bind -- safe
53
53
  var test = (function () { /* empty */ }).bind();
54
54
  // eslint-disable-next-line no-prototype-builtins -- safe
55
55
  return typeof test != 'function' || test.hasOwnProperty('prototype');
@@ -66,7 +66,7 @@
66
66
  var objectPropertyIsEnumerable = {};
67
67
 
68
68
  var $propertyIsEnumerable = {}.propertyIsEnumerable;
69
- // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
69
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
70
70
  var getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
71
71
 
72
72
  // Nashorn ~ JDK8 bug
@@ -153,20 +153,34 @@
153
153
  return IndexedObject(requireObjectCoercible$2(it));
154
154
  };
155
155
 
156
+ var documentAll$2 = typeof document == 'object' && document.all;
157
+
158
+ // https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot
159
+ var IS_HTMLDDA = typeof documentAll$2 == 'undefined' && documentAll$2 !== undefined;
160
+
161
+ var documentAll_1 = {
162
+ all: documentAll$2,
163
+ IS_HTMLDDA: IS_HTMLDDA
164
+ };
165
+
166
+ var $documentAll$1 = documentAll_1;
167
+
168
+ var documentAll$1 = $documentAll$1.all;
169
+
156
170
  // `IsCallable` abstract operation
157
171
  // https://tc39.es/ecma262/#sec-iscallable
158
- var isCallable$b = function (argument) {
172
+ var isCallable$b = $documentAll$1.IS_HTMLDDA ? function (argument) {
173
+ return typeof argument == 'function' || argument === documentAll$1;
174
+ } : function (argument) {
159
175
  return typeof argument == 'function';
160
176
  };
161
177
 
162
178
  var isCallable$a = isCallable$b;
179
+ var $documentAll = documentAll_1;
163
180
 
164
- var documentAll = typeof document == 'object' && document.all;
165
-
166
- // https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot
167
- var SPECIAL_DOCUMENT_ALL = typeof documentAll == 'undefined' && documentAll !== undefined;
181
+ var documentAll = $documentAll.all;
168
182
 
169
- var isObject$5 = SPECIAL_DOCUMENT_ALL ? function (it) {
183
+ var isObject$5 = $documentAll.IS_HTMLDDA ? function (it) {
170
184
  return typeof it == 'object' ? it !== null : isCallable$a(it) || it === documentAll;
171
185
  } : function (it) {
172
186
  return typeof it == 'object' ? it !== null : isCallable$a(it);
@@ -219,12 +233,12 @@
219
233
 
220
234
  var engineV8Version = version$1;
221
235
 
222
- /* eslint-disable es-x/no-symbol -- required for testing */
236
+ /* eslint-disable es/no-symbol -- required for testing */
223
237
 
224
238
  var V8_VERSION = engineV8Version;
225
239
  var fails$5 = fails$9;
226
240
 
227
- // eslint-disable-next-line es-x/no-object-getownpropertysymbols -- required for testing
241
+ // eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing
228
242
  var symbolConstructorDetection = !!Object.getOwnPropertySymbols && !fails$5(function () {
229
243
  var symbol = Symbol();
230
244
  // Chrome 38 Symbol has incorrect toString conversion
@@ -234,7 +248,7 @@
234
248
  !Symbol.sham && V8_VERSION && V8_VERSION < 41;
235
249
  });
236
250
 
237
- /* eslint-disable es-x/no-symbol -- required for testing */
251
+ /* eslint-disable es/no-symbol -- required for testing */
238
252
 
239
253
  var NATIVE_SYMBOL$1 = symbolConstructorDetection;
240
254
 
@@ -307,7 +321,7 @@
307
321
 
308
322
  var global$9 = global$c;
309
323
 
310
- // eslint-disable-next-line es-x/no-object-defineproperty -- safe
324
+ // eslint-disable-next-line es/no-object-defineproperty -- safe
311
325
  var defineProperty$1 = Object.defineProperty;
312
326
 
313
327
  var defineGlobalProperty$3 = function (key, value) {
@@ -331,10 +345,10 @@
331
345
  (shared$3.exports = function (key, value) {
332
346
  return store$2[key] || (store$2[key] = value !== undefined ? value : {});
333
347
  })('versions', []).push({
334
- version: '3.25.0',
348
+ version: '3.25.3',
335
349
  mode: 'global',
336
350
  copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',
337
- license: 'https://github.com/zloirock/core-js/blob/v3.25.0/LICENSE',
351
+ license: 'https://github.com/zloirock/core-js/blob/v3.25.3/LICENSE',
338
352
  source: 'https://github.com/zloirock/core-js'
339
353
  });
340
354
 
@@ -355,7 +369,7 @@
355
369
 
356
370
  // `HasOwnProperty` abstract operation
357
371
  // https://tc39.es/ecma262/#sec-hasownproperty
358
- // eslint-disable-next-line es-x/no-object-hasown -- safe
372
+ // eslint-disable-next-line es/no-object-hasown -- safe
359
373
  var hasOwnProperty_1 = Object.hasOwn || function hasOwn(it, key) {
360
374
  return hasOwnProperty(toObject(it), key);
361
375
  };
@@ -448,7 +462,7 @@
448
462
 
449
463
  // Thanks to IE8 for its funny defineProperty
450
464
  var ie8DomDefine = !DESCRIPTORS$6 && !fails$4(function () {
451
- // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
465
+ // eslint-disable-next-line es/no-object-defineproperty -- required for testing
452
466
  return Object.defineProperty(createElement('div'), 'a', {
453
467
  get: function () { return 7; }
454
468
  }).a != 7;
@@ -463,7 +477,7 @@
463
477
  var hasOwn$5 = hasOwnProperty_1;
464
478
  var IE8_DOM_DEFINE$1 = ie8DomDefine;
465
479
 
466
- // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
480
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
467
481
  var $getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
468
482
 
469
483
  // `Object.getOwnPropertyDescriptor` method
@@ -485,7 +499,7 @@
485
499
  // V8 ~ Chrome 36-
486
500
  // https://bugs.chromium.org/p/v8/issues/detail?id=3334
487
501
  var v8PrototypeDefineBug = DESCRIPTORS$4 && fails$3(function () {
488
- // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
502
+ // eslint-disable-next-line es/no-object-defineproperty -- required for testing
489
503
  return Object.defineProperty(function () { /* empty */ }, 'prototype', {
490
504
  value: 42,
491
505
  writable: false
@@ -510,9 +524,9 @@
510
524
  var toPropertyKey = toPropertyKey$2;
511
525
 
512
526
  var $TypeError = TypeError;
513
- // eslint-disable-next-line es-x/no-object-defineproperty -- safe
527
+ // eslint-disable-next-line es/no-object-defineproperty -- safe
514
528
  var $defineProperty = Object.defineProperty;
515
- // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
529
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
516
530
  var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
517
531
  var ENUMERABLE = 'enumerable';
518
532
  var CONFIGURABLE$1 = 'configurable';
@@ -564,7 +578,7 @@
564
578
  var hasOwn$4 = hasOwnProperty_1;
565
579
 
566
580
  var FunctionPrototype = Function.prototype;
567
- // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
581
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
568
582
  var getDescriptor = DESCRIPTORS$1 && Object.getOwnPropertyDescriptor;
569
583
 
570
584
  var EXISTS = hasOwn$4(FunctionPrototype, 'name');
@@ -691,7 +705,7 @@
691
705
 
692
706
  var enforceInternalState = InternalStateModule.enforce;
693
707
  var getInternalState = InternalStateModule.get;
694
- // eslint-disable-next-line es-x/no-object-defineproperty -- safe
708
+ // eslint-disable-next-line es/no-object-defineproperty -- safe
695
709
  var defineProperty = Object.defineProperty;
696
710
 
697
711
  var CONFIGURABLE_LENGTH = DESCRIPTORS && !fails$2(function () {
@@ -766,7 +780,7 @@
766
780
 
767
781
  // `Math.trunc` method
768
782
  // https://tc39.es/ecma262/#sec-math.trunc
769
- // eslint-disable-next-line es-x/no-math-trunc -- safe
783
+ // eslint-disable-next-line es/no-math-trunc -- safe
770
784
  var mathTrunc = Math.trunc || function trunc(x) {
771
785
  var n = +x;
772
786
  return (n > 0 ? floor : ceil)(n);
@@ -885,14 +899,14 @@
885
899
 
886
900
  // `Object.getOwnPropertyNames` method
887
901
  // https://tc39.es/ecma262/#sec-object.getownpropertynames
888
- // eslint-disable-next-line es-x/no-object-getownpropertynames -- safe
902
+ // eslint-disable-next-line es/no-object-getownpropertynames -- safe
889
903
  objectGetOwnPropertyNames.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
890
904
  return internalObjectKeys(O, hiddenKeys);
891
905
  };
892
906
 
893
907
  var objectGetOwnPropertySymbols = {};
894
908
 
895
- // eslint-disable-next-line es-x/no-object-getownpropertysymbols -- safe
909
+ // eslint-disable-next-line es/no-object-getownpropertysymbols -- safe
896
910
  objectGetOwnPropertySymbols.f = Object.getOwnPropertySymbols;
897
911
 
898
912
  var getBuiltIn = getBuiltIn$3;
@@ -1010,7 +1024,7 @@
1010
1024
 
1011
1025
  // `globalThis` object
1012
1026
  // https://tc39.es/ecma262/#sec-globalthis
1013
- $$4({ global: true }, {
1027
+ $$4({ global: true, forced: global$2.globalThis !== global$2 }, {
1014
1028
  globalThis: global$2
1015
1029
  });
1016
1030
 
@@ -1122,7 +1136,7 @@
1122
1136
  // https://tc39.es/ecma262/#String.prototype.trimleft
1123
1137
  var stringTrimStart = forcedStringTrimMethod$1('trimStart') ? function trimStart() {
1124
1138
  return $trimStart(this);
1125
- // eslint-disable-next-line es-x/no-string-prototype-trimstart-trimend -- safe
1139
+ // eslint-disable-next-line es/no-string-prototype-trimstart-trimend -- safe
1126
1140
  } : ''.trimStart;
1127
1141
 
1128
1142
  var $$3 = _export;
@@ -1130,7 +1144,7 @@
1130
1144
 
1131
1145
  // `String.prototype.trimLeft` method
1132
1146
  // https://tc39.es/ecma262/#sec-string.prototype.trimleft
1133
- // eslint-disable-next-line es-x/no-string-prototype-trimleft-trimright -- safe
1147
+ // eslint-disable-next-line es/no-string-prototype-trimleft-trimright -- safe
1134
1148
  $$3({ target: 'String', proto: true, name: 'trimStart', forced: ''.trimLeft !== trimStart$1 }, {
1135
1149
  trimLeft: trimStart$1
1136
1150
  });
@@ -1142,7 +1156,7 @@
1142
1156
 
1143
1157
  // `String.prototype.trimStart` method
1144
1158
  // https://tc39.es/ecma262/#sec-string.prototype.trimstart
1145
- // eslint-disable-next-line es-x/no-string-prototype-trimstart-trimend -- safe
1159
+ // eslint-disable-next-line es/no-string-prototype-trimstart-trimend -- safe
1146
1160
  $$2({ target: 'String', proto: true, name: 'trimStart', forced: ''.trimStart !== trimStart }, {
1147
1161
  trimStart: trimStart
1148
1162
  });
@@ -1166,7 +1180,7 @@
1166
1180
  // https://tc39.es/ecma262/#String.prototype.trimright
1167
1181
  var stringTrimEnd = forcedStringTrimMethod('trimEnd') ? function trimEnd() {
1168
1182
  return $trimEnd(this);
1169
- // eslint-disable-next-line es-x/no-string-prototype-trimstart-trimend -- safe
1183
+ // eslint-disable-next-line es/no-string-prototype-trimstart-trimend -- safe
1170
1184
  } : ''.trimEnd;
1171
1185
 
1172
1186
  var $$1 = _export;
@@ -1174,7 +1188,7 @@
1174
1188
 
1175
1189
  // `String.prototype.trimRight` method
1176
1190
  // https://tc39.es/ecma262/#sec-string.prototype.trimend
1177
- // eslint-disable-next-line es-x/no-string-prototype-trimleft-trimright -- safe
1191
+ // eslint-disable-next-line es/no-string-prototype-trimleft-trimright -- safe
1178
1192
  $$1({ target: 'String', proto: true, name: 'trimEnd', forced: ''.trimRight !== trimEnd$1 }, {
1179
1193
  trimRight: trimEnd$1
1180
1194
  });
@@ -1186,7 +1200,7 @@
1186
1200
 
1187
1201
  // `String.prototype.trimEnd` method
1188
1202
  // https://tc39.es/ecma262/#sec-string.prototype.trimend
1189
- // eslint-disable-next-line es-x/no-string-prototype-trimstart-trimend -- safe
1203
+ // eslint-disable-next-line es/no-string-prototype-trimstart-trimend -- safe
1190
1204
  $({ target: 'String', proto: true, name: 'trimEnd', forced: ''.trimEnd !== trimEnd }, {
1191
1205
  trimEnd: trimEnd
1192
1206
  });
@@ -33004,10 +33018,10 @@
33004
33018
  * this can be overridden by the plugin
33005
33019
  * @public
33006
33020
  * @type {string}
33007
- * @default "13.3.0"
33021
+ * @default "13.4.0"
33008
33022
  * @name plugin.Base#version
33009
33023
  */
33010
- this.version = "13.3.0";
33024
+ this.version = "13.4.0";
33011
33025
  };
33012
33026
 
33013
33027
  /**
@@ -34202,9 +34216,11 @@
34202
34216
  for (var i = 0; i < characters.length; i++) {
34203
34217
  var ch = characters[i].charCodeAt(0);
34204
34218
  var glyph = this.ancestor.fontData.glyphs[ch];
34205
- var kerning = (lastGlyph && lastGlyph.kerning) ? lastGlyph.getKerning(ch) : 0;
34206
- width += (glyph.xadvance + kerning) * this.ancestor.fontScale.x;
34207
- lastGlyph = glyph;
34219
+ if (typeof glyph !== "undefined") {
34220
+ var kerning = (lastGlyph && lastGlyph.kerning) ? lastGlyph.getKerning(ch) : 0;
34221
+ width += (glyph.xadvance + kerning) * this.ancestor.fontScale.x;
34222
+ lastGlyph = glyph;
34223
+ }
34208
34224
  }
34209
34225
  return width;
34210
34226
  }
@@ -35017,25 +35033,32 @@
35017
35033
  // calculate the char index
35018
35034
  var ch = string.charCodeAt(c);
35019
35035
  var glyph = this.fontData.glyphs[ch];
35020
- var glyphWidth = glyph.width;
35021
- var glyphHeight = glyph.height;
35022
- var kerning = (lastGlyph && lastGlyph.kerning) ? lastGlyph.getKerning(ch) : 0;
35023
-
35024
- // draw it
35025
- if (glyphWidth !== 0 && glyphHeight !== 0) {
35026
- // some browser throw an exception when drawing a 0 width or height image
35027
- renderer.drawImage(this.fontImage,
35028
- glyph.x, glyph.y,
35029
- glyphWidth, glyphHeight,
35030
- x + glyph.xoffset,
35031
- y + glyph.yoffset * this.fontScale.y,
35032
- glyphWidth * this.fontScale.x, glyphHeight * this.fontScale.y
35033
- );
35034
- }
35035
35036
 
35036
- // increment position
35037
- x += (glyph.xadvance + kerning) * this.fontScale.x;
35038
- lastGlyph = glyph;
35037
+ if (typeof glyph !== "undefined") {
35038
+ var glyphWidth = glyph.width;
35039
+ var glyphHeight = glyph.height;
35040
+ var kerning = (lastGlyph && lastGlyph.kerning) ? lastGlyph.getKerning(ch) : 0;
35041
+ var scaleX = this.fontScale.x;
35042
+ var scaleY = this.fontScale.y;
35043
+
35044
+ // draw it
35045
+ if (glyphWidth !== 0 && glyphHeight !== 0) {
35046
+ // some browser throw an exception when drawing a 0 width or height image
35047
+ renderer.drawImage(this.fontImage,
35048
+ glyph.x, glyph.y,
35049
+ glyphWidth, glyphHeight,
35050
+ x + glyph.xoffset * scaleX,
35051
+ y + glyph.yoffset * scaleY,
35052
+ glyphWidth * scaleX, glyphHeight * scaleY
35053
+ );
35054
+ }
35055
+
35056
+ // increment position
35057
+ x += (glyph.xadvance + kerning) * scaleX;
35058
+ lastGlyph = glyph;
35059
+ } else {
35060
+ console.warn("BitmapText: no defined Glyph in for " + String.fromCharCode(ch));
35061
+ }
35039
35062
  }
35040
35063
  // increment line
35041
35064
  y += stringHeight;
@@ -37701,7 +37724,7 @@
37701
37724
  * @name version
37702
37725
  * @type {string}
37703
37726
  */
37704
- var version = "13.3.0";
37727
+ var version = "13.4.0";
37705
37728
 
37706
37729
 
37707
37730
  /**