melonjs 15.1.3 → 15.1.5

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.
Files changed (164) hide show
  1. package/dist/melonjs.mjs/_virtual/_commonjsHelpers.js +1 -1
  2. package/dist/melonjs.mjs/_virtual/earcut.js +1 -1
  3. package/dist/melonjs.mjs/_virtual/howler.js +1 -1
  4. package/dist/melonjs.mjs/_virtual/index.js +1 -1
  5. package/dist/melonjs.mjs/application/application.js +1 -1
  6. package/dist/melonjs.mjs/application/header.js +1 -1
  7. package/dist/melonjs.mjs/application/resize.js +1 -1
  8. package/dist/melonjs.mjs/application/settings.js +1 -1
  9. package/dist/melonjs.mjs/audio/audio.js +3 -3
  10. package/dist/melonjs.mjs/camera/camera2d.js +1 -1
  11. package/dist/melonjs.mjs/const.js +2 -2
  12. package/dist/melonjs.mjs/entity/entity.js +3 -6
  13. package/dist/melonjs.mjs/geometries/ellipse.js +1 -1
  14. package/dist/melonjs.mjs/geometries/line.js +1 -1
  15. package/dist/melonjs.mjs/geometries/path2d.js +5 -5
  16. package/dist/melonjs.mjs/geometries/point.js +1 -1
  17. package/dist/melonjs.mjs/geometries/poly.js +3 -3
  18. package/dist/melonjs.mjs/geometries/rectangle.js +1 -1
  19. package/dist/melonjs.mjs/geometries/roundrect.js +1 -1
  20. package/dist/melonjs.mjs/index.js +2 -2
  21. package/dist/melonjs.mjs/input/gamepad.js +1 -1
  22. package/dist/melonjs.mjs/input/input.js +1 -1
  23. package/dist/melonjs.mjs/input/keyboard.js +1 -1
  24. package/dist/melonjs.mjs/input/pointer.js +1 -1
  25. package/dist/melonjs.mjs/input/pointerevent.js +10 -10
  26. package/dist/melonjs.mjs/lang/console.js +1 -1
  27. package/dist/melonjs.mjs/lang/deprecated.js +1 -1
  28. package/dist/melonjs.mjs/level/level.js +1 -1
  29. package/dist/melonjs.mjs/level/tiled/TMXGroup.js +1 -1
  30. package/dist/melonjs.mjs/level/tiled/TMXLayer.js +4 -4
  31. package/dist/melonjs.mjs/level/tiled/TMXObject.js +1 -1
  32. package/dist/melonjs.mjs/level/tiled/TMXTile.js +1 -1
  33. package/dist/melonjs.mjs/level/tiled/TMXTileMap.js +1 -1
  34. package/dist/melonjs.mjs/level/tiled/TMXTileset.js +1 -1
  35. package/dist/melonjs.mjs/level/tiled/TMXTilesetGroup.js +1 -1
  36. package/dist/melonjs.mjs/level/tiled/TMXUtils.js +4 -4
  37. package/dist/melonjs.mjs/level/tiled/constants.js +1 -1
  38. package/dist/melonjs.mjs/level/tiled/renderer/TMXHexagonalRenderer.js +2 -2
  39. package/dist/melonjs.mjs/level/tiled/renderer/TMXIsometricRenderer.js +1 -1
  40. package/dist/melonjs.mjs/level/tiled/renderer/TMXOrthogonalRenderer.js +1 -1
  41. package/dist/melonjs.mjs/level/tiled/renderer/TMXRenderer.js +2 -1
  42. package/dist/melonjs.mjs/level/tiled/renderer/TMXStaggeredRenderer.js +1 -1
  43. package/dist/melonjs.mjs/level/tiled/renderer/autodetect.js +1 -1
  44. package/dist/melonjs.mjs/loader/cache.js +1 -1
  45. package/dist/melonjs.mjs/loader/loader.js +53 -67
  46. package/dist/melonjs.mjs/loader/loadingscreen.js +1 -1
  47. package/dist/melonjs.mjs/loader/melonjs_logo.png.js +1 -1
  48. package/dist/melonjs.mjs/loader/parser.js +1 -1
  49. package/dist/melonjs.mjs/loader/settings.js +1 -1
  50. package/dist/melonjs.mjs/math/color.js +1 -1
  51. package/dist/melonjs.mjs/math/math.js +1 -1
  52. package/dist/melonjs.mjs/math/matrix2.js +1 -1
  53. package/dist/melonjs.mjs/math/matrix3.js +1 -1
  54. package/dist/melonjs.mjs/math/observable_vector2.js +1 -1
  55. package/dist/melonjs.mjs/math/observable_vector3.js +1 -1
  56. package/dist/melonjs.mjs/math/vector2.js +1 -1
  57. package/dist/melonjs.mjs/math/vector3.js +1 -1
  58. package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/esm/arraymultimap.js +1 -1
  59. package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/esm/multimap.js +1 -1
  60. package/dist/melonjs.mjs/node_modules/earcut/src/earcut.js +1 -1
  61. package/dist/melonjs.mjs/node_modules/eventemitter3/index.js +1 -1
  62. package/dist/melonjs.mjs/node_modules/eventemitter3/index2.js +1 -1
  63. package/dist/melonjs.mjs/node_modules/howler/dist/howler.js +1 -1
  64. package/dist/melonjs.mjs/particles/emitter.js +1 -1
  65. package/dist/melonjs.mjs/particles/particle.js +1 -1
  66. package/dist/melonjs.mjs/particles/settings.js +1 -1
  67. package/dist/melonjs.mjs/physics/body.js +1 -1
  68. package/dist/melonjs.mjs/physics/bounds.js +2 -2
  69. package/dist/melonjs.mjs/physics/collision.js +1 -1
  70. package/dist/melonjs.mjs/physics/detector.js +2 -2
  71. package/dist/melonjs.mjs/physics/quadtree.js +2 -2
  72. package/dist/melonjs.mjs/physics/response.js +1 -1
  73. package/dist/melonjs.mjs/physics/sat.js +5 -4
  74. package/dist/melonjs.mjs/physics/world.js +1 -1
  75. package/dist/melonjs.mjs/plugin/plugin.js +3 -3
  76. package/dist/melonjs.mjs/renderable/collectable.js +1 -1
  77. package/dist/melonjs.mjs/renderable/colorlayer.js +1 -1
  78. package/dist/melonjs.mjs/renderable/container.js +35 -25
  79. package/dist/melonjs.mjs/renderable/dragndrop.js +1 -1
  80. package/dist/melonjs.mjs/renderable/imagelayer.js +1 -1
  81. package/dist/melonjs.mjs/renderable/light2d.js +1 -1
  82. package/dist/melonjs.mjs/renderable/nineslicesprite.js +1 -1
  83. package/dist/melonjs.mjs/renderable/renderable.js +6 -9
  84. package/dist/melonjs.mjs/renderable/sprite.js +1 -1
  85. package/dist/melonjs.mjs/renderable/trigger.js +1 -1
  86. package/dist/melonjs.mjs/renderable/ui/uibaseelement.js +7 -4
  87. package/dist/melonjs.mjs/renderable/ui/uispriteelement.js +8 -2
  88. package/dist/melonjs.mjs/renderable/ui/uitextbutton.js +1 -1
  89. package/dist/melonjs.mjs/state/stage.js +1 -1
  90. package/dist/melonjs.mjs/state/state.js +1 -1
  91. package/dist/melonjs.mjs/system/device.js +1 -1
  92. package/dist/melonjs.mjs/system/dom.js +1 -1
  93. package/dist/melonjs.mjs/system/event.js +1 -1
  94. package/dist/melonjs.mjs/system/platform.js +1 -1
  95. package/dist/melonjs.mjs/system/pooling.js +1 -1
  96. package/dist/melonjs.mjs/system/save.js +1 -1
  97. package/dist/melonjs.mjs/system/timer.js +1 -1
  98. package/dist/melonjs.mjs/text/bitmaptext.js +3 -3
  99. package/dist/melonjs.mjs/text/bitmaptextdata.js +1 -1
  100. package/dist/melonjs.mjs/text/glyph.js +1 -1
  101. package/dist/melonjs.mjs/text/text.js +2 -2
  102. package/dist/melonjs.mjs/text/textmetrics.js +1 -1
  103. package/dist/melonjs.mjs/text/textstyle.js +1 -1
  104. package/dist/melonjs.mjs/tweens/easing.js +1 -1
  105. package/dist/melonjs.mjs/tweens/interpolation.js +1 -1
  106. package/dist/melonjs.mjs/tweens/tween.js +1 -1
  107. package/dist/melonjs.mjs/utils/agent.js +1 -1
  108. package/dist/melonjs.mjs/utils/array.js +1 -1
  109. package/dist/melonjs.mjs/utils/file.js +1 -1
  110. package/dist/melonjs.mjs/utils/function.js +1 -1
  111. package/dist/melonjs.mjs/utils/string.js +1 -1
  112. package/dist/melonjs.mjs/utils/utils.js +1 -1
  113. package/dist/melonjs.mjs/video/canvas/canvas_renderer.js +3 -6
  114. package/dist/melonjs.mjs/video/renderer.js +1 -1
  115. package/dist/melonjs.mjs/video/texture/atlas.js +1 -1
  116. package/dist/melonjs.mjs/video/texture/cache.js +1 -1
  117. package/dist/melonjs.mjs/video/texture/canvas_texture.js +2 -2
  118. package/dist/melonjs.mjs/video/utils/autodetect.js +1 -1
  119. package/dist/melonjs.mjs/video/video.js +10 -3
  120. package/dist/melonjs.mjs/video/webgl/buffer/vertex.js +1 -1
  121. package/dist/melonjs.mjs/video/webgl/compositors/compositor.js +1 -1
  122. package/dist/melonjs.mjs/video/webgl/compositors/primitive_compositor.js +1 -1
  123. package/dist/melonjs.mjs/video/webgl/compositors/quad_compositor.js +1 -1
  124. package/dist/melonjs.mjs/video/webgl/glshader.js +1 -1
  125. package/dist/melonjs.mjs/video/webgl/shaders/primitive.frag.js +1 -1
  126. package/dist/melonjs.mjs/video/webgl/shaders/primitive.vert.js +1 -1
  127. package/dist/melonjs.mjs/video/webgl/shaders/quad.frag.js +1 -1
  128. package/dist/melonjs.mjs/video/webgl/shaders/quad.vert.js +1 -1
  129. package/dist/melonjs.mjs/video/webgl/utils/attributes.js +1 -1
  130. package/dist/melonjs.mjs/video/webgl/utils/precision.js +1 -1
  131. package/dist/melonjs.mjs/video/webgl/utils/program.js +1 -1
  132. package/dist/melonjs.mjs/video/webgl/utils/string.js +1 -1
  133. package/dist/melonjs.mjs/video/webgl/utils/uniforms.js +1 -1
  134. package/dist/melonjs.mjs/video/webgl/webgl_renderer.js +1 -1
  135. package/dist/melonjs.module.js +150 -152
  136. package/dist/types/audio/audio.d.ts +2 -2
  137. package/dist/types/const.d.ts +2 -2
  138. package/dist/types/loader/loader.d.ts +54 -55
  139. package/dist/types/renderable/renderable.d.ts +1 -1
  140. package/dist/types/video/video.d.ts +1 -1
  141. package/package.json +8 -8
  142. package/src/audio/audio.js +2 -2
  143. package/src/const.js +1 -1
  144. package/src/entity/entity.js +2 -5
  145. package/src/geometries/path2d.js +4 -4
  146. package/src/geometries/poly.js +2 -2
  147. package/src/input/pointerevent.js +9 -9
  148. package/src/level/tiled/TMXLayer.js +3 -3
  149. package/src/level/tiled/TMXUtils.js +3 -3
  150. package/src/level/tiled/renderer/TMXHexagonalRenderer.js +1 -1
  151. package/src/loader/loader.js +52 -66
  152. package/src/physics/bounds.js +1 -1
  153. package/src/physics/detector.js +1 -1
  154. package/src/physics/quadtree.js +1 -1
  155. package/src/physics/sat.js +3 -3
  156. package/src/renderable/container.js +34 -24
  157. package/src/renderable/renderable.js +5 -8
  158. package/src/renderable/ui/uibaseelement.js +6 -3
  159. package/src/renderable/ui/uispriteelement.js +7 -1
  160. package/src/text/bitmaptext.js +2 -2
  161. package/src/text/text.js +1 -1
  162. package/src/video/canvas/canvas_renderer.js +2 -5
  163. package/src/video/texture/canvas_texture.js +1 -1
  164. package/src/video/video.js +1 -1
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * melonJS Game Engine - v15.1.3
2
+ * melonJS Game Engine - v15.1.5
3
3
  * http://www.melonjs.org
4
4
  * melonjs is licensed under the MIT License.
5
5
  * http://www.opensource.org/licenses/mit-license
@@ -200,10 +200,16 @@ let globalFloatingCounter = 0;
200
200
  }
201
201
  }
202
202
 
203
+ // add the new child
203
204
  child.ancestor = this;
204
205
  this.getChildren().push(child);
206
+
207
+ // update child bounds to reflect the new ancestor
205
208
  if (typeof child.updateBounds === "function") {
206
- // update child bounds to reflect the new ancestor
209
+ if (this.isFloating === true) {
210
+ // only parent container can be floating
211
+ child.floating = false;
212
+ }
207
213
  child.updateBounds();
208
214
  }
209
215
 
@@ -224,12 +230,7 @@ let globalFloatingCounter = 0;
224
230
  child.onActivateEvent();
225
231
  }
226
232
 
227
- // force repaint in case this is a static non-animated object
228
- if (this.isAttachedToRoot() === true) {
229
- this.isDirty = true;
230
- }
231
-
232
- // force bounds update if required
233
+ // force container bounds update if required
233
234
  if (this.enableChildBoundsUpdate === true) {
234
235
  this.updateBounds();
235
236
  }
@@ -252,6 +253,9 @@ let globalFloatingCounter = 0;
252
253
  }
253
254
  }
254
255
 
256
+ // mark the container for repaint
257
+ this.isDirty = true;
258
+
255
259
  // triggered callback if defined
256
260
  this.onChildChange.call(this, this.getChildren().length - 1);
257
261
 
@@ -278,20 +282,25 @@ let globalFloatingCounter = 0;
278
282
  child.GUID = utils.createGUID();
279
283
  }
280
284
  }
281
- child.ancestor = this;
282
285
 
286
+ // add the new child
287
+ child.ancestor = this;
283
288
  this.getChildren().splice(index, 0, child);
284
289
 
285
- if (typeof child.onActivateEvent === "function" && this.isAttachedToRoot()) {
286
- child.onActivateEvent();
290
+ // update child bounds to reflect the new ancestor
291
+ if (typeof child.updateBounds === "function") {
292
+ if (this.isFloating === true) {
293
+ // only parent container can be floating
294
+ child.floating = false;
295
+ }
296
+ child.updateBounds();
287
297
  }
288
298
 
289
- // force repaint in case this is a static non-animated object
290
- if (this.isAttachedToRoot() === true) {
291
- this.isDirty = true;
299
+ if (typeof child.onActivateEvent === "function" && this.isAttachedToRoot()) {
300
+ child.onActivateEvent();
292
301
  }
293
302
 
294
- // force bounds update if required
303
+ // force container bounds update if required
295
304
  if (this.enableChildBoundsUpdate === true) {
296
305
  this.updateBounds();
297
306
  }
@@ -314,6 +323,9 @@ let globalFloatingCounter = 0;
314
323
  }
315
324
  }
316
325
 
326
+ // mark the container for repaint
327
+ this.isDirty = true;
328
+
317
329
  // triggered callback if defined
318
330
  this.onChildChange.call(this, index);
319
331
 
@@ -538,10 +550,9 @@ let globalFloatingCounter = 0;
538
550
  }
539
551
 
540
552
  /**
541
- * update the bounding box for this shape.
542
- * @ignore
543
- * @param {boolean} absolute - update the bounds size and position in (world) absolute coordinates
544
- * @returns {Bounds} this shape bounding box Rectangle object
553
+ * update the bounding box for this container.
554
+ * @param {boolean} [absolute=true] - update the bounds size and position in (world) absolute coordinates
555
+ * @returns {Bounds} this container bounding box Rectangle object
545
556
  */
546
557
  updateBounds(absolute = true) {
547
558
  let bounds = this.getBounds();
@@ -552,13 +563,14 @@ let globalFloatingCounter = 0;
552
563
  if (this.enableChildBoundsUpdate === true) {
553
564
  this.forEach((child) => {
554
565
  if (child.isRenderable) {
555
- let childBounds = child.getBounds();
566
+ let childBounds = child.updateBounds(true);
556
567
  if (childBounds.isFinite()) {
557
568
  bounds.addBounds(childBounds);
558
569
  }
559
570
  }
560
571
  });
561
572
  }
573
+
562
574
  return bounds;
563
575
  }
564
576
 
@@ -682,16 +694,14 @@ let globalFloatingCounter = 0;
682
694
  child.ancestor = undefined;
683
695
  }
684
696
 
685
- // force repaint in case this is a static non-animated object
686
- if (this.isAttachedToRoot() === true) {
687
- this.isDirty = true;
688
- }
689
-
690
697
  // force bounds update if required
691
698
  if (this.enableChildBoundsUpdate === true) {
692
699
  this.updateBounds();
693
700
  }
694
701
 
702
+ // mark the container for repaint
703
+ this.isDirty = true;
704
+
695
705
  // triggered callback if defined
696
706
  this.onChildChange.call(this, childIndex);
697
707
  }
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * melonJS Game Engine - v15.1.3
2
+ * melonJS Game Engine - v15.1.5
3
3
  * http://www.melonjs.org
4
4
  * melonjs is licensed under the MIT License.
5
5
  * http://www.opensource.org/licenses/mit-license
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * melonJS Game Engine - v15.1.3
2
+ * melonJS Game Engine - v15.1.5
3
3
  * http://www.melonjs.org
4
4
  * melonjs is licensed under the MIT License.
5
5
  * http://www.opensource.org/licenses/mit-license
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * melonJS Game Engine - v15.1.3
2
+ * melonJS Game Engine - v15.1.5
3
3
  * http://www.melonjs.org
4
4
  * melonjs is licensed under the MIT License.
5
5
  * http://www.opensource.org/licenses/mit-license
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * melonJS Game Engine - v15.1.3
2
+ * melonJS Game Engine - v15.1.5
3
3
  * http://www.melonjs.org
4
4
  * melonjs is licensed under the MIT License.
5
5
  * http://www.opensource.org/licenses/mit-license
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * melonJS Game Engine - v15.1.3
2
+ * melonJS Game Engine - v15.1.5
3
3
  * http://www.melonjs.org
4
4
  * melonjs is licensed under the MIT License.
5
5
  * http://www.opensource.org/licenses/mit-license
@@ -270,12 +270,12 @@ import { releaseAllPointerEvents } from '../input/pointerevent.js';
270
270
  }
271
271
 
272
272
  /**
273
- * Whether the renderable object is floating, or contained in a floating container
273
+ * Whether the renderable object is floating (i.e. used screen coordinates), or contained in a floating parent container
274
274
  * @see Renderable#floating
275
275
  * @type {boolean}
276
276
  */
277
277
  get isFloating() {
278
- return this.floating === true || (typeof this.ancestor !== "undefined" && this.ancestor.floating === true);
278
+ return this.floating === true || (typeof this.ancestor !== "undefined" && this.ancestor.isFloating === true);
279
279
  }
280
280
 
281
281
  /**
@@ -584,11 +584,8 @@ import { releaseAllPointerEvents } from '../input/pointerevent.js';
584
584
  }
585
585
 
586
586
  if (absolute === true) {
587
- bounds.centerOn(this.pos.x + bounds.x + bounds.width / 2, this.pos.y + bounds.y + bounds.height / 2);
588
- if (typeof this.ancestor !== "undefined" && typeof this.ancestor.addChild === "function" && this.floating !== true) {
589
- bounds.translate(this.ancestor.getAbsolutePosition());
590
- }
591
-
587
+ var absPos = this.getAbsolutePosition();
588
+ bounds.centerOn(absPos.x + bounds.x + bounds.width / 2, absPos.y + bounds.y + bounds.height / 2);
592
589
  }
593
590
  return bounds;
594
591
 
@@ -617,7 +614,7 @@ import { releaseAllPointerEvents } from '../input/pointerevent.js';
617
614
  }
618
615
  // XXX Cache me or something
619
616
  this._absPos.set(this.pos.x, this.pos.y);
620
- if (typeof this.ancestor !== "undefined" && typeof this.ancestor.addChild === "function" && this.floating !== true) {
617
+ if (typeof this.ancestor !== "undefined" && typeof this.ancestor.getAbsolutePosition === "function" && this.floating !== true) {
621
618
  this._absPos.add(this.ancestor.getAbsolutePosition());
622
619
  }
623
620
  return this._absPos;
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * melonJS Game Engine - v15.1.3
2
+ * melonJS Game Engine - v15.1.5
3
3
  * http://www.melonjs.org
4
4
  * melonjs is licensed under the MIT License.
5
5
  * http://www.opensource.org/licenses/mit-license
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * melonJS Game Engine - v15.1.3
2
+ * melonJS Game Engine - v15.1.5
3
3
  * http://www.melonjs.org
4
4
  * melonjs is licensed under the MIT License.
5
5
  * http://www.opensource.org/licenses/mit-license
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * melonJS Game Engine - v15.1.3
2
+ * melonJS Game Engine - v15.1.5
3
3
  * http://www.melonjs.org
4
4
  * melonjs is licensed under the MIT License.
5
5
  * http://www.opensource.org/licenses/mit-license
@@ -71,7 +71,7 @@ import { registerPointerEvent, releasePointerEvent } from '../../input/pointerev
71
71
 
72
72
  /**
73
73
  * UI base elements use screen coordinates by default
74
- * (Note: any child elements added to a UIBaseElement should set their floating property to false)
74
+ * (Note: any child elements added to a UIBaseElement should have their floating property to false)
75
75
  * @see Renderable.floating
76
76
  * @type {boolean}
77
77
  * @default true
@@ -83,6 +83,9 @@ import { registerPointerEvent, releasePointerEvent } from '../../input/pointerev
83
83
 
84
84
  // enable event detection
85
85
  this.isKinematic = false;
86
+
87
+ // update container and children bounds automatically
88
+ this.enableChildBoundsUpdate = true;
86
89
  }
87
90
 
88
91
  /**
@@ -117,7 +120,7 @@ import { registerPointerEvent, releasePointerEvent } from '../../input/pointerev
117
120
  * @returns {boolean} return false if we need to stop propagating the event
118
121
  */
119
122
  onClick(event) { // eslint-disable-line no-unused-vars
120
- return false;
123
+ return true;
121
124
  }
122
125
 
123
126
  /**
@@ -210,7 +213,7 @@ import { registerPointerEvent, releasePointerEvent } from '../../input/pointerev
210
213
  * @returns {boolean} return false if we need to stop propagating the event
211
214
  */
212
215
  onRelease() {
213
- return false;
216
+ return true;
214
217
  }
215
218
 
216
219
  /**
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * melonJS Game Engine - v15.1.3
2
+ * melonJS Game Engine - v15.1.5
3
3
  * http://www.melonjs.org
4
4
  * melonjs is licensed under the MIT License.
5
5
  * http://www.opensource.org/licenses/mit-license
@@ -80,7 +80,13 @@ import { registerPointerEvent, releasePointerEvent } from '../../input/pointerev
80
80
  this.holdTimeout = -1;
81
81
  this.released = true;
82
82
 
83
- // GUI items use screen coordinates
83
+ /**
84
+ * if this UISpriteElement should use screen coordinates or local coordinates
85
+ * (Note: any UISpriteElement elements added to a floating parent container should have their floating property to false)
86
+ * @see Renderable.floating
87
+ * @type {boolean}
88
+ * @default true
89
+ */
84
90
  this.floating = true;
85
91
 
86
92
  // enable event detection
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * melonJS Game Engine - v15.1.3
2
+ * melonJS Game Engine - v15.1.5
3
3
  * http://www.melonjs.org
4
4
  * melonjs is licensed under the MIT License.
5
5
  * http://www.opensource.org/licenses/mit-license
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * melonJS Game Engine - v15.1.3
2
+ * melonJS Game Engine - v15.1.5
3
3
  * http://www.melonjs.org
4
4
  * melonjs is licensed under the MIT License.
5
5
  * http://www.opensource.org/licenses/mit-license
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * melonJS Game Engine - v15.1.3
2
+ * melonJS Game Engine - v15.1.5
3
3
  * http://www.melonjs.org
4
4
  * melonjs is licensed under the MIT License.
5
5
  * http://www.opensource.org/licenses/mit-license
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * melonJS Game Engine - v15.1.3
2
+ * melonJS Game Engine - v15.1.5
3
3
  * http://www.melonjs.org
4
4
  * melonjs is licensed under the MIT License.
5
5
  * http://www.opensource.org/licenses/mit-license
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * melonJS Game Engine - v15.1.3
2
+ * melonJS Game Engine - v15.1.5
3
3
  * http://www.melonjs.org
4
4
  * melonjs is licensed under the MIT License.
5
5
  * http://www.opensource.org/licenses/mit-license
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * melonJS Game Engine - v15.1.3
2
+ * melonJS Game Engine - v15.1.5
3
3
  * http://www.melonjs.org
4
4
  * melonjs is licensed under the MIT License.
5
5
  * http://www.opensource.org/licenses/mit-license
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * melonJS Game Engine - v15.1.3
2
+ * melonJS Game Engine - v15.1.5
3
3
  * http://www.melonjs.org
4
4
  * melonjs is licensed under the MIT License.
5
5
  * http://www.opensource.org/licenses/mit-license
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * melonJS Game Engine - v15.1.3
2
+ * melonJS Game Engine - v15.1.5
3
3
  * http://www.melonjs.org
4
4
  * melonjs is licensed under the MIT License.
5
5
  * http://www.opensource.org/licenses/mit-license
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * melonJS Game Engine - v15.1.3
2
+ * melonJS Game Engine - v15.1.5
3
3
  * http://www.melonjs.org
4
4
  * melonjs is licensed under the MIT License.
5
5
  * http://www.opensource.org/licenses/mit-license
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * melonJS Game Engine - v15.1.3
2
+ * melonJS Game Engine - v15.1.5
3
3
  * http://www.melonjs.org
4
4
  * melonjs is licensed under the MIT License.
5
5
  * http://www.opensource.org/licenses/mit-license
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * melonJS Game Engine - v15.1.3
2
+ * melonJS Game Engine - v15.1.5
3
3
  * http://www.melonjs.org
4
4
  * melonjs is licensed under the MIT License.
5
5
  * http://www.opensource.org/licenses/mit-license
@@ -239,7 +239,7 @@ import TextMetrics from './textmetrics.js';
239
239
  }
240
240
 
241
241
  if (absolute === true) {
242
- if (typeof this.ancestor !== "undefined" && typeof this.ancestor.addChild === "function" && this.floating !== true) {
242
+ if (typeof this.ancestor !== "undefined" && typeof this.ancestor.getAbsolutePosition === "function" && this.floating !== true) {
243
243
  bounds.translate(this.ancestor.getAbsolutePosition());
244
244
  }
245
245
  }
@@ -318,7 +318,7 @@ import TextMetrics from './textmetrics.js';
318
318
 
319
319
  for (let i = 0; i < this._text.length; i++) {
320
320
  x = lX;
321
- let string = this._text[i].trimEnd();
321
+ const string = this._text[i].trimEnd();
322
322
  // adjust x pos based on alignment value
323
323
  let stringWidth = this.metrics.lineWidth(string);
324
324
  switch (this.textAlign) {
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * melonJS Game Engine - v15.1.3
2
+ * melonJS Game Engine - v15.1.5
3
3
  * http://www.melonjs.org
4
4
  * melonjs is licensed under the MIT License.
5
5
  * http://www.opensource.org/licenses/mit-license
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * melonJS Game Engine - v15.1.3
2
+ * melonJS Game Engine - v15.1.5
3
3
  * http://www.melonjs.org
4
4
  * melonjs is licensed under the MIT License.
5
5
  * http://www.opensource.org/licenses/mit-license
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * melonJS Game Engine - v15.1.3
2
+ * melonJS Game Engine - v15.1.5
3
3
  * http://www.melonjs.org
4
4
  * melonjs is licensed under the MIT License.
5
5
  * http://www.opensource.org/licenses/mit-license
@@ -382,7 +382,7 @@ const toPX = [12, 24, 0.75, 1];
382
382
  setContextStyle(context, this);
383
383
 
384
384
  for (let i = 0; i < text.length; i++) {
385
- let string = text[i].trimEnd();
385
+ const string = text[i].trimEnd();
386
386
  // draw the string
387
387
  if (this.fillStyle.alpha > 0) {
388
388
  context.fillText(string, x, y);
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * melonJS Game Engine - v15.1.3
2
+ * melonJS Game Engine - v15.1.5
3
3
  * http://www.melonjs.org
4
4
  * melonjs is licensed under the MIT License.
5
5
  * http://www.opensource.org/licenses/mit-license
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * melonJS Game Engine - v15.1.3
2
+ * melonJS Game Engine - v15.1.5
3
3
  * http://www.melonjs.org
4
4
  * melonjs is licensed under the MIT License.
5
5
  * http://www.opensource.org/licenses/mit-license
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * melonJS Game Engine - v15.1.3
2
+ * melonJS Game Engine - v15.1.5
3
3
  * http://www.melonjs.org
4
4
  * melonjs is licensed under the MIT License.
5
5
  * http://www.opensource.org/licenses/mit-license
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * melonJS Game Engine - v15.1.3
2
+ * melonJS Game Engine - v15.1.5
3
3
  * http://www.melonjs.org
4
4
  * melonjs is licensed under the MIT License.
5
5
  * http://www.opensource.org/licenses/mit-license
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * melonJS Game Engine - v15.1.3
2
+ * melonJS Game Engine - v15.1.5
3
3
  * http://www.melonjs.org
4
4
  * melonjs is licensed under the MIT License.
5
5
  * http://www.opensource.org/licenses/mit-license
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * melonJS Game Engine - v15.1.3
2
+ * melonJS Game Engine - v15.1.5
3
3
  * http://www.melonjs.org
4
4
  * melonjs is licensed under the MIT License.
5
5
  * http://www.opensource.org/licenses/mit-license
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * melonJS Game Engine - v15.1.3
2
+ * melonJS Game Engine - v15.1.5
3
3
  * http://www.melonjs.org
4
4
  * melonjs is licensed under the MIT License.
5
5
  * http://www.opensource.org/licenses/mit-license
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * melonJS Game Engine - v15.1.3
2
+ * melonJS Game Engine - v15.1.5
3
3
  * http://www.melonjs.org
4
4
  * melonjs is licensed under the MIT License.
5
5
  * http://www.opensource.org/licenses/mit-license
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * melonJS Game Engine - v15.1.3
2
+ * melonJS Game Engine - v15.1.5
3
3
  * http://www.melonjs.org
4
4
  * melonjs is licensed under the MIT License.
5
5
  * http://www.opensource.org/licenses/mit-license
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * melonJS Game Engine - v15.1.3
2
+ * melonJS Game Engine - v15.1.5
3
3
  * http://www.melonjs.org
4
4
  * melonjs is licensed under the MIT License.
5
5
  * http://www.opensource.org/licenses/mit-license
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * melonJS Game Engine - v15.1.3
2
+ * melonJS Game Engine - v15.1.5
3
3
  * http://www.melonjs.org
4
4
  * melonjs is licensed under the MIT License.
5
5
  * http://www.opensource.org/licenses/mit-license
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * melonJS Game Engine - v15.1.3
2
+ * melonJS Game Engine - v15.1.5
3
3
  * http://www.melonjs.org
4
4
  * melonjs is licensed under the MIT License.
5
5
  * http://www.opensource.org/licenses/mit-license
@@ -399,9 +399,8 @@ import { emit, on, ONCONTEXT_LOST, ONCONTEXT_RESTORED, GAME_RESET } from '../../
399
399
  this.translate(poly.pos.x, poly.pos.y);
400
400
  context.beginPath();
401
401
  context.moveTo(poly.points[0].x, poly.points[0].y);
402
- let point;
403
402
  for (let i = 1; i < poly.points.length; i++) {
404
- point = poly.points[i];
403
+ const point = poly.points[i];
405
404
  context.lineTo(point.x, point.y);
406
405
  }
407
406
  context.lineTo(poly.points[0].x, poly.points[0].y);
@@ -696,11 +695,9 @@ import { emit, on, ONCONTEXT_LOST, ONCONTEXT_RESTORED, GAME_RESET } from '../../
696
695
  } else {
697
696
  // polygon
698
697
  const _x = mask.pos.x, _y = mask.pos.y;
699
- let point;
700
-
701
698
  context.moveTo(_x + mask.points[0].x, _y + mask.points[0].y);
702
699
  for (let i = 1; i < mask.points.length; i++) {
703
- point = mask.points[i];
700
+ const point = mask.points[i];
704
701
  context.lineTo(_x + point.x, _y + point.y);
705
702
  }
706
703
  }
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * melonJS Game Engine - v15.1.3
2
+ * melonJS Game Engine - v15.1.5
3
3
  * http://www.melonjs.org
4
4
  * melonjs is licensed under the MIT License.
5
5
  * http://www.opensource.org/licenses/mit-license
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * melonJS Game Engine - v15.1.3
2
+ * melonJS Game Engine - v15.1.5
3
3
  * http://www.melonjs.org
4
4
  * melonjs is licensed under the MIT License.
5
5
  * http://www.opensource.org/licenses/mit-license
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * melonJS Game Engine - v15.1.3
2
+ * melonJS Game Engine - v15.1.5
3
3
  * http://www.melonjs.org
4
4
  * melonjs is licensed under the MIT License.
5
5
  * http://www.opensource.org/licenses/mit-license
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * melonJS Game Engine - v15.1.3
2
+ * melonJS Game Engine - v15.1.5
3
3
  * http://www.melonjs.org
4
4
  * melonjs is licensed under the MIT License.
5
5
  * http://www.opensource.org/licenses/mit-license
@@ -45,7 +45,7 @@ class CanvasTexture {
45
45
  * the rendering context of this CanvasTexture
46
46
  * @type {CanvasRenderingContext2D}
47
47
  */
48
- this.context = this.canvas.getContext("2d", { willReadFrequently: attributes.willReadFrequently });
48
+ this.context = this.canvas.getContext(attributes.context, { willReadFrequently: attributes.willReadFrequently });
49
49
 
50
50
  // enable or disable antiAlias if specified
51
51
  this.setAntiAlias(attributes.antiAlias);
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * melonJS Game Engine - v15.1.3
2
+ * melonJS Game Engine - v15.1.5
3
3
  * http://www.melonjs.org
4
4
  * melonjs is licensed under the MIT License.
5
5
  * http://www.opensource.org/licenses/mit-license
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * melonJS Game Engine - v15.1.3
2
+ * melonJS Game Engine - v15.1.5
3
3
  * http://www.melonjs.org
4
4
  * melonjs is licensed under the MIT License.
5
5
  * http://www.opensource.org/licenses/mit-license
@@ -7,7 +7,7 @@
7
7
  */
8
8
  import { emit, WINDOW_ONRESIZE, WINDOW_ONORIENTATION_CHANGE, WINDOW_ONSCROLL, VIDEO_INIT } from '../system/event.js';
9
9
  import { game, initialized } from '../index.js';
10
- import { screenOrientation } from '../system/device.js';
10
+ import { offscreenCanvas, screenOrientation } from '../system/device.js';
11
11
  import utils from '../utils/utils.js';
12
12
  import { CANVAS as CANVAS$1, WEBGL as WEBGL$1, AUTO as AUTO$1 } from '../const.js';
13
13
 
@@ -162,7 +162,14 @@ function createCanvas(width, height, returnOffscreenCanvas = false) {
162
162
  throw new Error("width or height was zero, Canvas could not be initialized !");
163
163
  }
164
164
 
165
- {
165
+ if (offscreenCanvas === true && returnOffscreenCanvas === true) {
166
+ _canvas = new globalThis.OffscreenCanvas(0, 0);
167
+ // stubbing style for compatibility,
168
+ // as OffscreenCanvas is detached from the DOM
169
+ if (typeof _canvas.style === "undefined") {
170
+ _canvas.style = {};
171
+ }
172
+ } else {
166
173
  // "else" create a "standard" canvas
167
174
  _canvas = document.createElement("canvas");
168
175
  }