melonjs 15.1.4 → 15.1.6

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 (174) 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 +1 -1
  10. package/dist/melonjs.mjs/camera/camera2d.js +3 -3
  11. package/dist/melonjs.mjs/const.js +1 -1
  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 +4 -3
  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 +3 -2
  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 +4 -3
  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 +3 -3
  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 +5 -5
  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 +13 -12
  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 +48 -38
  79. package/dist/melonjs.mjs/renderable/draggable.js +121 -0
  80. package/dist/melonjs.mjs/renderable/dragndrop.js +3 -113
  81. package/dist/melonjs.mjs/renderable/imagelayer.js +1 -1
  82. package/dist/melonjs.mjs/renderable/light2d.js +1 -1
  83. package/dist/melonjs.mjs/renderable/nineslicesprite.js +1 -1
  84. package/dist/melonjs.mjs/renderable/renderable.js +7 -10
  85. package/dist/melonjs.mjs/renderable/sprite.js +1 -1
  86. package/dist/melonjs.mjs/renderable/trigger.js +2 -2
  87. package/dist/melonjs.mjs/renderable/ui/uibaseelement.js +7 -4
  88. package/dist/melonjs.mjs/renderable/ui/uispriteelement.js +8 -2
  89. package/dist/melonjs.mjs/renderable/ui/uitextbutton.js +1 -1
  90. package/dist/melonjs.mjs/state/stage.js +1 -1
  91. package/dist/melonjs.mjs/state/state.js +1 -1
  92. package/dist/melonjs.mjs/system/device.js +1 -1
  93. package/dist/melonjs.mjs/system/dom.js +1 -1
  94. package/dist/melonjs.mjs/system/event.js +1 -1
  95. package/dist/melonjs.mjs/system/platform.js +1 -1
  96. package/dist/melonjs.mjs/system/pooling.js +1 -1
  97. package/dist/melonjs.mjs/system/save.js +1 -1
  98. package/dist/melonjs.mjs/system/timer.js +1 -1
  99. package/dist/melonjs.mjs/text/bitmaptext.js +3 -3
  100. package/dist/melonjs.mjs/text/bitmaptextdata.js +1 -1
  101. package/dist/melonjs.mjs/text/glyph.js +1 -1
  102. package/dist/melonjs.mjs/text/text.js +2 -2
  103. package/dist/melonjs.mjs/text/textmetrics.js +1 -1
  104. package/dist/melonjs.mjs/text/textstyle.js +1 -1
  105. package/dist/melonjs.mjs/tweens/easing.js +1 -1
  106. package/dist/melonjs.mjs/tweens/interpolation.js +1 -1
  107. package/dist/melonjs.mjs/tweens/tween.js +1 -1
  108. package/dist/melonjs.mjs/utils/agent.js +1 -1
  109. package/dist/melonjs.mjs/utils/array.js +1 -1
  110. package/dist/melonjs.mjs/utils/file.js +1 -1
  111. package/dist/melonjs.mjs/utils/function.js +1 -1
  112. package/dist/melonjs.mjs/utils/string.js +1 -1
  113. package/dist/melonjs.mjs/utils/utils.js +1 -1
  114. package/dist/melonjs.mjs/video/canvas/canvas_renderer.js +3 -6
  115. package/dist/melonjs.mjs/video/renderer.js +1 -1
  116. package/dist/melonjs.mjs/video/texture/atlas.js +1 -1
  117. package/dist/melonjs.mjs/video/texture/cache.js +1 -1
  118. package/dist/melonjs.mjs/video/texture/canvas_texture.js +2 -2
  119. package/dist/melonjs.mjs/video/utils/autodetect.js +1 -1
  120. package/dist/melonjs.mjs/video/video.js +1 -1
  121. package/dist/melonjs.mjs/video/webgl/buffer/vertex.js +1 -1
  122. package/dist/melonjs.mjs/video/webgl/compositors/compositor.js +1 -1
  123. package/dist/melonjs.mjs/video/webgl/compositors/primitive_compositor.js +1 -1
  124. package/dist/melonjs.mjs/video/webgl/compositors/quad_compositor.js +1 -1
  125. package/dist/melonjs.mjs/video/webgl/glshader.js +1 -1
  126. package/dist/melonjs.mjs/video/webgl/shaders/primitive.frag.js +1 -1
  127. package/dist/melonjs.mjs/video/webgl/shaders/primitive.vert.js +1 -1
  128. package/dist/melonjs.mjs/video/webgl/shaders/quad.frag.js +1 -1
  129. package/dist/melonjs.mjs/video/webgl/shaders/quad.vert.js +1 -1
  130. package/dist/melonjs.mjs/video/webgl/utils/attributes.js +1 -1
  131. package/dist/melonjs.mjs/video/webgl/utils/precision.js +1 -1
  132. package/dist/melonjs.mjs/video/webgl/utils/program.js +1 -1
  133. package/dist/melonjs.mjs/video/webgl/utils/string.js +1 -1
  134. package/dist/melonjs.mjs/video/webgl/utils/uniforms.js +1 -1
  135. package/dist/melonjs.mjs/video/webgl/webgl_renderer.js +1 -1
  136. package/dist/melonjs.module.js +153 -135
  137. package/dist/types/camera/camera2d.d.ts +4 -4
  138. package/dist/types/index.d.ts +1 -1
  139. package/dist/types/loader/loader.d.ts +9 -4
  140. package/dist/types/physics/body.d.ts +4 -4
  141. package/dist/types/physics/detector.d.ts +5 -5
  142. package/dist/types/physics/sat.d.ts +12 -12
  143. package/dist/types/renderable/container.d.ts +25 -25
  144. package/dist/types/renderable/draggable.d.ts +53 -0
  145. package/dist/types/renderable/dragndrop.d.ts +0 -52
  146. package/dist/types/renderable/renderable.d.ts +3 -3
  147. package/package.json +11 -11
  148. package/src/camera/camera2d.js +2 -2
  149. package/src/entity/entity.js +2 -5
  150. package/src/geometries/path2d.js +4 -4
  151. package/src/geometries/poly.js +2 -2
  152. package/src/index.js +2 -1
  153. package/src/input/pointerevent.js +9 -9
  154. package/src/lang/deprecated.js +2 -1
  155. package/src/level/tiled/TMXLayer.js +3 -3
  156. package/src/level/tiled/TMXUtils.js +3 -3
  157. package/src/level/tiled/renderer/TMXHexagonalRenderer.js +1 -1
  158. package/src/loader/loader.js +3 -2
  159. package/src/physics/body.js +2 -2
  160. package/src/physics/bounds.js +1 -1
  161. package/src/physics/detector.js +4 -4
  162. package/src/physics/quadtree.js +1 -1
  163. package/src/physics/sat.js +11 -11
  164. package/src/renderable/container.js +47 -37
  165. package/src/renderable/draggable.js +114 -0
  166. package/src/renderable/dragndrop.js +0 -109
  167. package/src/renderable/renderable.js +6 -9
  168. package/src/renderable/trigger.js +1 -1
  169. package/src/renderable/ui/uibaseelement.js +6 -3
  170. package/src/renderable/ui/uispriteelement.js +7 -1
  171. package/src/text/bitmaptext.js +2 -2
  172. package/src/text/text.js +1 -1
  173. package/src/video/canvas/canvas_renderer.js +2 -5
  174. package/src/video/texture/canvas_texture.js +1 -1
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * melonJS Game Engine - v15.1.4
2
+ * melonJS Game Engine - v15.1.6
3
3
  * http://www.melonjs.org
4
4
  * melonjs is licensed under the MIT License.
5
5
  * http://www.opensource.org/licenses/mit-license
@@ -56,7 +56,7 @@ var check = function (it) {
56
56
  };
57
57
 
58
58
  // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
59
- var global$d =
59
+ var global$e =
60
60
  // eslint-disable-next-line es/no-global-this -- safe
61
61
  check(typeof globalThis == 'object' && globalThis) ||
62
62
  check(typeof window == 'object' && window) ||
@@ -64,9 +64,9 @@ var global$d =
64
64
  check(typeof self == 'object' && self) ||
65
65
  check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
66
66
  // eslint-disable-next-line no-new-func -- fallback
67
- (function () { return this; })() || Function('return this')();
67
+ (function () { return this; })() || commonjsGlobal || Function('return this')();
68
68
 
69
- var global$e = /*@__PURE__*/getDefaultExportFromCjs(global$d);
69
+ var global$f = /*@__PURE__*/getDefaultExportFromCjs(global$e);
70
70
 
71
71
  var objectGetOwnPropertyDescriptor = {};
72
72
 
@@ -253,7 +253,7 @@ var isObject$5 = $documentAll.IS_HTMLDDA ? function (it) {
253
253
 
254
254
  var isObject$6 = /*@__PURE__*/getDefaultExportFromCjs(isObject$5);
255
255
 
256
- var global$c = global$d;
256
+ var global$d = global$e;
257
257
  var isCallable$9 = isCallable$b;
258
258
 
259
259
  var aFunction = function (argument) {
@@ -261,7 +261,7 @@ var aFunction = function (argument) {
261
261
  };
262
262
 
263
263
  var getBuiltIn$2 = function (namespace, method) {
264
- return arguments.length < 2 ? aFunction(global$c[namespace]) : global$c[namespace] && global$c[namespace][method];
264
+ return arguments.length < 2 ? aFunction(global$d[namespace]) : global$d[namespace] && global$d[namespace][method];
265
265
  };
266
266
 
267
267
  var getBuiltIn$3 = /*@__PURE__*/getDefaultExportFromCjs(getBuiltIn$2);
@@ -276,11 +276,11 @@ var engineUserAgent = typeof navigator != 'undefined' && String(navigator.userAg
276
276
 
277
277
  var engineUserAgent$1 = /*@__PURE__*/getDefaultExportFromCjs(engineUserAgent);
278
278
 
279
- var global$b = global$d;
279
+ var global$c = global$e;
280
280
  var userAgent = engineUserAgent;
281
281
 
282
- var process = global$b.process;
283
- var Deno = global$b.Deno;
282
+ var process = global$c.process;
283
+ var Deno = global$c.Deno;
284
284
  var versions = process && process.versions || Deno && Deno.version;
285
285
  var v8 = versions && versions.v8;
286
286
  var match, version$1;
@@ -310,13 +310,18 @@ var engineV8Version$1 = /*@__PURE__*/getDefaultExportFromCjs(engineV8Version);
310
310
 
311
311
  var V8_VERSION = engineV8Version;
312
312
  var fails$5 = fails$9;
313
+ var global$b = global$e;
314
+
315
+ var $String$4 = global$b.String;
313
316
 
314
317
  // eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing
315
318
  var symbolConstructorDetection = !!Object.getOwnPropertySymbols && !fails$5(function () {
316
319
  var symbol = Symbol();
317
320
  // Chrome 38 Symbol has incorrect toString conversion
318
321
  // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
319
- return !String(symbol) || !(Object(symbol) instanceof Symbol) ||
322
+ // nb: Do not call `String` directly to avoid this being optimized out to `symbol+''` which will,
323
+ // of course, fail.
324
+ return !$String$4(symbol) || !(Object(symbol) instanceof Symbol) ||
320
325
  // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
321
326
  !Symbol.sham && V8_VERSION && V8_VERSION < 41;
322
327
  });
@@ -410,7 +415,7 @@ var isPure = false;
410
415
 
411
416
  var isPure$1 = /*@__PURE__*/getDefaultExportFromCjs(isPure);
412
417
 
413
- var global$a = global$d;
418
+ var global$a = global$e;
414
419
 
415
420
  // eslint-disable-next-line es/no-object-defineproperty -- safe
416
421
  var defineProperty$1 = Object.defineProperty;
@@ -425,7 +430,7 @@ var defineGlobalProperty$3 = function (key, value) {
425
430
 
426
431
  var defineGlobalProperty$4 = /*@__PURE__*/getDefaultExportFromCjs(defineGlobalProperty$3);
427
432
 
428
- var global$9 = global$d;
433
+ var global$9 = global$e;
429
434
  var defineGlobalProperty$2 = defineGlobalProperty$3;
430
435
 
431
436
  var SHARED = '__core-js_shared__';
@@ -443,10 +448,10 @@ var store$2 = sharedStore;
443
448
  (shared$5.exports = function (key, value) {
444
449
  return store$2[key] || (store$2[key] = value !== undefined ? value : {});
445
450
  })('versions', []).push({
446
- version: '3.30.1',
451
+ version: '3.30.2',
447
452
  mode: IS_PURE ? 'pure' : 'global',
448
453
  copyright: '© 2014-2023 Denis Pushkarev (zloirock.ru)',
449
- license: 'https://github.com/zloirock/core-js/blob/v3.30.1/LICENSE',
454
+ license: 'https://github.com/zloirock/core-js/blob/v3.30.2/LICENSE',
450
455
  source: 'https://github.com/zloirock/core-js'
451
456
  });
452
457
 
@@ -491,7 +496,7 @@ var uid$2 = function (key) {
491
496
 
492
497
  var uid$3 = /*@__PURE__*/getDefaultExportFromCjs(uid$2);
493
498
 
494
- var global$8 = global$d;
499
+ var global$8 = global$e;
495
500
  var shared$2 = sharedExports;
496
501
  var hasOwn$6 = hasOwnProperty_1;
497
502
  var uid$1 = uid$2;
@@ -552,7 +557,7 @@ var toPropertyKey$2 = function (argument) {
552
557
 
553
558
  var toPropertyKey$3 = /*@__PURE__*/getDefaultExportFromCjs(toPropertyKey$2);
554
559
 
555
- var global$7 = global$d;
560
+ var global$7 = global$e;
556
561
  var isObject$2 = isObject$5;
557
562
 
558
563
  var document$1 = global$7.document;
@@ -728,7 +733,7 @@ var inspectSource$1 = store$1.inspectSource;
728
733
 
729
734
  var inspectSource$2 = /*@__PURE__*/getDefaultExportFromCjs(inspectSource$1);
730
735
 
731
- var global$6 = global$d;
736
+ var global$6 = global$e;
732
737
  var isCallable$4 = isCallable$b;
733
738
 
734
739
  var WeakMap$1 = global$6.WeakMap;
@@ -753,7 +758,7 @@ var hiddenKeys$3 = {};
753
758
  var hiddenKeys$4 = /*@__PURE__*/getDefaultExportFromCjs(hiddenKeys$3);
754
759
 
755
760
  var NATIVE_WEAK_MAP = weakMapBasicDetection;
756
- var global$5 = global$d;
761
+ var global$5 = global$e;
757
762
  var isObject = isObject$5;
758
763
  var createNonEnumerableProperty$1 = createNonEnumerableProperty$2;
759
764
  var hasOwn$3 = hasOwnProperty_1;
@@ -1128,7 +1133,7 @@ var isForced_1 = isForced$1;
1128
1133
 
1129
1134
  var isForced$2 = /*@__PURE__*/getDefaultExportFromCjs(isForced_1);
1130
1135
 
1131
- var global$4 = global$d;
1136
+ var global$4 = global$e;
1132
1137
  var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
1133
1138
  var createNonEnumerableProperty = createNonEnumerableProperty$2;
1134
1139
  var defineBuiltIn = defineBuiltIn$1;
@@ -1186,7 +1191,7 @@ var _export = function (options, source) {
1186
1191
  var _export$1 = /*@__PURE__*/getDefaultExportFromCjs(_export);
1187
1192
 
1188
1193
  var $$4 = _export;
1189
- var global$3 = global$d;
1194
+ var global$3 = global$e;
1190
1195
 
1191
1196
  // `globalThis` object
1192
1197
  // https://tc39.es/ecma262/#sec-globalthis
@@ -1196,7 +1201,7 @@ $$4({ global: true, forced: global$3.globalThis !== global$3 }, {
1196
1201
 
1197
1202
  // https://github.com/tc39/proposal-global
1198
1203
 
1199
- var global$2 = global$d;
1204
+ var global$2 = global$e;
1200
1205
 
1201
1206
  var globalThis$1 = global$2;
1202
1207
 
@@ -1353,7 +1358,7 @@ $$2({ target: 'String', proto: true, name: 'trimStart', forced: ''.trimStart !==
1353
1358
  trimStart: trimStart$2
1354
1359
  });
1355
1360
 
1356
- var global$1 = global$d;
1361
+ var global$1 = global$e;
1357
1362
  var uncurryThis = functionUncurryThis;
1358
1363
 
1359
1364
  var entryUnbind$2 = function (CONSTRUCTOR, METHOD) {
@@ -7020,8 +7025,8 @@ var earcut$1 = /*@__PURE__*/getDefaultExportFromCjs(earcutExports);
7020
7025
 
7021
7026
  //http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html
7022
7027
  for (let i = 0, j = len - 1; i < len; j = i++) {
7023
- let iy = points[i].y + posy, ix = points[i].x + posx,
7024
- jy = points[j].y + posy, jx = points[j].x + posx;
7028
+ const iy = points[i].y + posy, ix = points[i].x + posx,
7029
+ jy = points[j].y + posy, jx = points[j].x + posx;
7025
7030
  if (((iy > _y) !== (jy > _y)) && (_x < (jx - ix) * (_y - iy) / (jy - iy) + ix)) {
7026
7031
  intersects = !intersects;
7027
7032
  }
@@ -8449,7 +8454,7 @@ let QT_VECTOR = new Vector2d();
8449
8454
  */
8450
8455
  hasChildren() {
8451
8456
  for (let i = 0; i < this.nodes.length; i = i + 1) {
8452
- let subnode = this.nodes[i];
8457
+ const subnode = this.nodes[i];
8453
8458
  if (subnode.length > 0 || subnode.objects.length > 0) {
8454
8459
  return true;
8455
8460
  }
@@ -8670,7 +8675,7 @@ let QT_VECTOR = new Vector2d();
8670
8675
  this.clear();
8671
8676
  }
8672
8677
  for (let i = 0; i < vertices.length; i++) {
8673
- let vertex = vertices[i];
8678
+ const vertex = vertices[i];
8674
8679
  if (vertex.x > this.max.x) this.max.x = vertex.x;
8675
8680
  if (vertex.x < this.min.x) this.min.x = vertex.x;
8676
8681
  if (vertex.y > this.max.y) this.max.y = vertex.y;
@@ -16641,7 +16646,7 @@ function enablePointerEvent() {
16641
16646
  */
16642
16647
  function findActiveEvent(activeEventList, eventTypes) {
16643
16648
  for (let i = 0; i < eventTypes.length; i++) {
16644
- let event = activeEventList.indexOf(eventTypes[i]);
16649
+ const event = activeEventList.indexOf(eventTypes[i]);
16645
16650
  if (event !== -1) {
16646
16651
  return eventTypes[i];
16647
16652
  }
@@ -16654,7 +16659,7 @@ function findActiveEvent(activeEventList, eventTypes) {
16654
16659
  function findAllActiveEvents(activeEventList, eventTypes) {
16655
16660
  let events = [];
16656
16661
  for (let i = 0; i < eventTypes.length; i++) {
16657
- let event = activeEventList.indexOf(eventTypes[i]);
16662
+ const event = activeEventList.indexOf(eventTypes[i]);
16658
16663
  if (event !== -1) {
16659
16664
  events.push(eventTypes[i]);
16660
16665
  }
@@ -16724,10 +16729,10 @@ function dispatchEvent(normalizedEvents) {
16724
16729
 
16725
16730
  for (let c = candidates.length, candidate; c--, (candidate = candidates[c]);) {
16726
16731
  if (eventHandlers.has(candidate) && (candidate.isKinematic !== true)) {
16727
- let handlers = eventHandlers.get(candidate);
16728
- let region = handlers.region;
16729
- let ancestor = region.ancestor;
16730
- let bounds = region.getBounds();
16732
+ const handlers = eventHandlers.get(candidate);
16733
+ const region = handlers.region;
16734
+ const ancestor = region.ancestor;
16735
+ const bounds = region.getBounds();
16731
16736
  let eventInBounds = false;
16732
16737
 
16733
16738
  if (region.isFloating === true) {
@@ -16835,7 +16840,7 @@ function normalizeEvent(originalEvent) {
16835
16840
  if (touchEvent && originalEvent.changedTouches) {
16836
16841
  // iOS/Android Touch event
16837
16842
  for (let i = 0, l = originalEvent.changedTouches.length; i < l; i++) {
16838
- let touchEvent = originalEvent.changedTouches[i];
16843
+ const touchEvent = originalEvent.changedTouches[i];
16839
16844
  _pointer = T_POINTERS.pop();
16840
16845
  _pointer.setEvent(
16841
16846
  originalEvent,
@@ -17113,7 +17118,7 @@ function registerPointerEvent(eventType, region, callback) {
17113
17118
  // allocate array if not defined
17114
17119
  let handlers = eventHandlers.get(region);
17115
17120
  for (let i = 0; i < eventTypes.length; i++) {
17116
- eventType = eventTypes[i];
17121
+ const eventType = eventTypes[i];
17117
17122
  if (handlers.callbacks[eventType]) {
17118
17123
  handlers.callbacks[eventType].push(callback);
17119
17124
  } else {
@@ -17146,7 +17151,7 @@ function releasePointerEvent(eventType, region, callback) {
17146
17151
  let handlers = eventHandlers.get(region);
17147
17152
  if (typeof (handlers) !== "undefined") {
17148
17153
  for (let i = 0; i < eventTypes.length; i++) {
17149
- eventType = eventTypes[i];
17154
+ const eventType = eventTypes[i];
17150
17155
  if (handlers.callbacks[eventType]) {
17151
17156
  if (typeof (callback) !== "undefined") {
17152
17157
  remove(handlers.callbacks[eventType], callback);
@@ -18012,12 +18017,12 @@ var input = {
18012
18017
  }
18013
18018
 
18014
18019
  /**
18015
- * Whether the renderable object is floating, or contained in a floating container
18020
+ * Whether the renderable object is floating (i.e. used screen coordinates), or contained in a floating parent container
18016
18021
  * @see Renderable#floating
18017
18022
  * @type {boolean}
18018
18023
  */
18019
18024
  get isFloating() {
18020
- return this.floating === true || (typeof this.ancestor !== "undefined" && this.ancestor.floating === true);
18025
+ return this.floating === true || (typeof this.ancestor !== "undefined" && this.ancestor.isFloating === true);
18021
18026
  }
18022
18027
 
18023
18028
  /**
@@ -18326,11 +18331,8 @@ var input = {
18326
18331
  }
18327
18332
 
18328
18333
  if (absolute === true) {
18329
- bounds.centerOn(this.pos.x + bounds.x + bounds.width / 2, this.pos.y + bounds.y + bounds.height / 2);
18330
- if (typeof this.ancestor !== "undefined" && typeof this.ancestor.addChild === "function" && this.floating !== true) {
18331
- bounds.translate(this.ancestor.getAbsolutePosition());
18332
- }
18333
-
18334
+ var absPos = this.getAbsolutePosition();
18335
+ bounds.centerOn(absPos.x + bounds.x + bounds.width / 2, absPos.y + bounds.y + bounds.height / 2);
18334
18336
  }
18335
18337
  return bounds;
18336
18338
 
@@ -18359,7 +18361,7 @@ var input = {
18359
18361
  }
18360
18362
  // XXX Cache me or something
18361
18363
  this._absPos.set(this.pos.x, this.pos.y);
18362
- if (typeof this.ancestor !== "undefined" && typeof this.ancestor.addChild === "function" && this.floating !== true) {
18364
+ if (typeof this.ancestor !== "undefined" && typeof this.ancestor.getAbsolutePosition === "function" && this.floating !== true) {
18363
18365
  this._absPos.add(this.ancestor.getAbsolutePosition());
18364
18366
  }
18365
18367
  return this._absPos;
@@ -18477,7 +18479,7 @@ var input = {
18477
18479
  * onCollision callback, triggered in case of collision,
18478
18480
  * when this renderable body is colliding with another one
18479
18481
  * @param {ResponseObject} response - the collision response object
18480
- * @param {Renderable} other - the other renderable touching this one (a reference to response.a or response.b)
18482
+ * @param {Renderable|Container|Entity|Sprite|NineSliceSprite} other - the other renderable touching this one (a reference to response.a or response.b)
18481
18483
  * @returns {boolean} true if the object should respond to the collision (its position and velocity will be corrected)
18482
18484
  * @example
18483
18485
  * // colision handler
@@ -19124,7 +19126,7 @@ let targetV = new Vector2d();
19124
19126
  * set the camera position around the specified object
19125
19127
  * @name focusOn
19126
19128
  * @memberof Camera2d
19127
- * @param {Renderable} target - the renderable to focus the camera on
19129
+ * @param {Renderable|Entity|Sprite|NineSliceSprite} target - the renderable to focus the camera on
19128
19130
  */
19129
19131
  focusOn(target) {
19130
19132
  let bounds = target.getBounds();
@@ -19138,7 +19140,7 @@ let targetV = new Vector2d();
19138
19140
  * check if the specified renderable is in the camera
19139
19141
  * @name isVisible
19140
19142
  * @memberof Camera2d
19141
- * @param {Renderable} obj - to be checked against
19143
+ * @param {Renderable|Entity|Sprite|NineSliceSprite} obj - to be checked against
19142
19144
  * @param {boolean} [floating = obj.floating] - if visibility check should be done against screen coordinates
19143
19145
  * @returns {boolean}
19144
19146
  */
@@ -19951,7 +19953,7 @@ function parseAttributes(obj, elt) {
19951
19953
  // do attributes
19952
19954
  if (elt.attributes && elt.attributes.length > 0) {
19953
19955
  for (let j = 0; j < elt.attributes.length; j++) {
19954
- let attribute = elt.attributes.item(j);
19956
+ const attribute = elt.attributes.item(j);
19955
19957
  if (typeof(attribute.name) !== "undefined") {
19956
19958
  // DOM4 (Attr no longer inherit from Node)
19957
19959
  obj[attribute.name] = attribute.value;
@@ -20150,8 +20152,8 @@ function normalize(obj, item) {
20150
20152
  var points = parse(item).points.split(" "); // <= "Unexpected lexical declaration in case block" if using let
20151
20153
 
20152
20154
  // And normalize them into an array of vectors
20153
- for (let i = 0, v; i < points.length; i++) {
20154
- v = points[i].split(",");
20155
+ for (let i = 0; i < points.length; i++) {
20156
+ const v = points[i].split(",");
20155
20157
  obj[nodeName].push({
20156
20158
  "x" : +v[0],
20157
20159
  "y" : +v[1]
@@ -20930,10 +20932,10 @@ class TMXObject {
20930
20932
  const cos_rotation = Math.cos(rotation);
20931
20933
  const sin_rotation = Math.sin(rotation);
20932
20934
  for (let j = 0; j < nr_of_interpolation_points; j++) {
20933
- let _x1 = radiusX * Math.cos(angle);
20934
- let _y1 = radiusY * Math.sin(angle);
20935
- let _x2 = x + _x1 * cos_rotation - _y1 * sin_rotation;
20936
- let _y2 = y + _x1 * sin_rotation + _y1 * cos_rotation;
20935
+ const _x1 = radiusX * Math.cos(angle);
20936
+ const _y1 = radiusY * Math.sin(angle);
20937
+ const _x2 = x + _x1 * cos_rotation - _y1 * sin_rotation;
20938
+ const _y2 = y + _x1 * sin_rotation + _y1 * cos_rotation;
20937
20939
  points.push(pool.pull("Point", _x2, _y2));
20938
20940
  angle += direction * dangle;
20939
20941
  }
@@ -22639,9 +22641,8 @@ class TextureCache {
22639
22641
  this.translate(poly.pos.x, poly.pos.y);
22640
22642
  context.beginPath();
22641
22643
  context.moveTo(poly.points[0].x, poly.points[0].y);
22642
- let point;
22643
22644
  for (let i = 1; i < poly.points.length; i++) {
22644
- point = poly.points[i];
22645
+ const point = poly.points[i];
22645
22646
  context.lineTo(point.x, point.y);
22646
22647
  }
22647
22648
  context.lineTo(poly.points[0].x, poly.points[0].y);
@@ -22936,11 +22937,9 @@ class TextureCache {
22936
22937
  } else {
22937
22938
  // polygon
22938
22939
  const _x = mask.pos.x, _y = mask.pos.y;
22939
- let point;
22940
-
22941
22940
  context.moveTo(_x + mask.points[0].x, _y + mask.points[0].y);
22942
22941
  for (let i = 1; i < mask.points.length; i++) {
22943
- point = mask.points[i];
22942
+ const point = mask.points[i];
22944
22943
  context.lineTo(_x + point.x, _y + point.y);
22945
22944
  }
22946
22945
  }
@@ -23004,7 +23003,7 @@ function setLayerData(layer, bounds, data) {
23004
23003
  for (let y = 0; y < height; y++) {
23005
23004
  for (let x = 0; x < width; x++) {
23006
23005
  // get the value of the gid
23007
- let gid = data[idx++];
23006
+ const gid = data[idx++];
23008
23007
  // fill the array
23009
23008
  if (gid !== 0) {
23010
23009
  // add a new tile to the layer
@@ -23023,7 +23022,7 @@ function preRenderLayer(layer, renderer) {
23023
23022
  for (let y = 0; y < layer.rows; y++) {
23024
23023
  for (let x = 0; x < layer.cols; x++) {
23025
23024
  // get the value of the gid
23026
- let tile = layer.layerData[x][y];
23025
+ const tile = layer.layerData[x][y];
23027
23026
  // draw the tile if defined
23028
23027
  if (tile instanceof Tile) {
23029
23028
  // add a new tile to the layer
@@ -23090,7 +23089,7 @@ function preRenderLayer(layer, renderer) {
23090
23089
  "height" : 0
23091
23090
  };
23092
23091
  for (let i = 0; i < this.tilesets.length; i++) {
23093
- let tileset = this.tilesets.getTilesetByIndex(i);
23092
+ const tileset = this.tilesets.getTilesetByIndex(i);
23094
23093
  this.maxTileSize.width = Math.max(this.maxTileSize.width, tileset.tilewidth);
23095
23094
  this.maxTileSize.height = Math.max(this.maxTileSize.height, tileset.tileheight);
23096
23095
  }
@@ -23678,7 +23677,7 @@ let globalFloatingCounter = 0;
23678
23677
  * will not be in any container. <br>
23679
23678
  * if the given child implements a onActivateEvent method, that method will be called
23680
23679
  * once the child is added to this container.
23681
- * @param {Renderable} child
23680
+ * @param {Renderable|Entity|Sprite|Collectable|Trigger|Draggable|DropTarget|NineSliceSprite|ImageLayer|ColorLayer|Light2d|UIBaseElement|UISpriteElement|UITextButton|Text|BitmapText} child
23682
23681
  * @param {number} [z] - forces the z index of the child to the specified value
23683
23682
  * @returns {Renderable} the added child
23684
23683
  */
@@ -23695,10 +23694,16 @@ let globalFloatingCounter = 0;
23695
23694
  }
23696
23695
  }
23697
23696
 
23697
+ // add the new child
23698
23698
  child.ancestor = this;
23699
23699
  this.getChildren().push(child);
23700
+
23701
+ // update child bounds to reflect the new ancestor
23700
23702
  if (typeof child.updateBounds === "function") {
23701
- // update child bounds to reflect the new ancestor
23703
+ if (this.isFloating === true) {
23704
+ // only parent container can be floating
23705
+ child.floating = false;
23706
+ }
23702
23707
  child.updateBounds();
23703
23708
  }
23704
23709
 
@@ -23719,12 +23724,7 @@ let globalFloatingCounter = 0;
23719
23724
  child.onActivateEvent();
23720
23725
  }
23721
23726
 
23722
- // force repaint in case this is a static non-animated object
23723
- if (this.isAttachedToRoot() === true) {
23724
- this.isDirty = true;
23725
- }
23726
-
23727
- // force bounds update if required
23727
+ // force container bounds update if required
23728
23728
  if (this.enableChildBoundsUpdate === true) {
23729
23729
  this.updateBounds();
23730
23730
  }
@@ -23747,6 +23747,9 @@ let globalFloatingCounter = 0;
23747
23747
  }
23748
23748
  }
23749
23749
 
23750
+ // mark the container for repaint
23751
+ this.isDirty = true;
23752
+
23750
23753
  // triggered callback if defined
23751
23754
  this.onChildChange.call(this, this.getChildren().length - 1);
23752
23755
 
@@ -23756,7 +23759,7 @@ let globalFloatingCounter = 0;
23756
23759
  /**
23757
23760
  * Add a child to the container at the specified index<br>
23758
23761
  * (the list won't be sorted after insertion)
23759
- * @param {Renderable} child
23762
+ * @param {Renderable|Entity|Sprite|Collectable|Trigger|Draggable|DropTarget|NineSliceSprite|ImageLayer|ColorLayer|Light2d|UIBaseElement|UISpriteElement|UITextButton|Text|BitmapText} child
23760
23763
  * @param {number} index
23761
23764
  * @returns {Renderable} the added child
23762
23765
  */
@@ -23773,20 +23776,25 @@ let globalFloatingCounter = 0;
23773
23776
  child.GUID = utils.createGUID();
23774
23777
  }
23775
23778
  }
23776
- child.ancestor = this;
23777
23779
 
23780
+ // add the new child
23781
+ child.ancestor = this;
23778
23782
  this.getChildren().splice(index, 0, child);
23779
23783
 
23780
- if (typeof child.onActivateEvent === "function" && this.isAttachedToRoot()) {
23781
- child.onActivateEvent();
23784
+ // update child bounds to reflect the new ancestor
23785
+ if (typeof child.updateBounds === "function") {
23786
+ if (this.isFloating === true) {
23787
+ // only parent container can be floating
23788
+ child.floating = false;
23789
+ }
23790
+ child.updateBounds();
23782
23791
  }
23783
23792
 
23784
- // force repaint in case this is a static non-animated object
23785
- if (this.isAttachedToRoot() === true) {
23786
- this.isDirty = true;
23793
+ if (typeof child.onActivateEvent === "function" && this.isAttachedToRoot()) {
23794
+ child.onActivateEvent();
23787
23795
  }
23788
23796
 
23789
- // force bounds update if required
23797
+ // force container bounds update if required
23790
23798
  if (this.enableChildBoundsUpdate === true) {
23791
23799
  this.updateBounds();
23792
23800
  }
@@ -23809,6 +23817,9 @@ let globalFloatingCounter = 0;
23809
23817
  }
23810
23818
  }
23811
23819
 
23820
+ // mark the container for repaint
23821
+ this.isDirty = true;
23822
+
23812
23823
  // triggered callback if defined
23813
23824
  this.onChildChange.call(this, index);
23814
23825
 
@@ -23859,8 +23870,8 @@ let globalFloatingCounter = 0;
23859
23870
 
23860
23871
  /**
23861
23872
  * Swaps the position (z-index) of 2 children
23862
- * @param {Renderable} child
23863
- * @param {Renderable} child2
23873
+ * @param {Renderable|Entity|Sprite|Collectable|Trigger|Draggable|DropTarget|NineSliceSprite|ImageLayer|ColorLayer|Light2d|UIBaseElement|UISpriteElement|UITextButton|Text|BitmapText} child
23874
+ * @param {Renderable|Entity|Sprite|Collectable|Trigger|Draggable|DropTarget|NineSliceSprite|ImageLayer|ColorLayer|Light2d|UIBaseElement|UISpriteElement|UITextButton|Text|BitmapText} child2
23864
23875
  */
23865
23876
  swapChildren(child, child2) {
23866
23877
  let index = this.getChildIndex(child);
@@ -23898,7 +23909,7 @@ let globalFloatingCounter = 0;
23898
23909
 
23899
23910
  /**
23900
23911
  * Returns the index of the given Child
23901
- * @param {Renderable} child
23912
+ * @param {Renderable|Entity|Sprite|Collectable|Trigger|Draggable|DropTarget|NineSliceSprite|ImageLayer|ColorLayer|Light2d|UIBaseElement|UISpriteElement|UITextButton|Text|BitmapText} child
23902
23913
  * @returns {number} index
23903
23914
  */
23904
23915
  getChildIndex(child) {
@@ -23907,7 +23918,7 @@ let globalFloatingCounter = 0;
23907
23918
 
23908
23919
  /**
23909
23920
  * Returns the next child within the container or undefined if none
23910
- * @param {Renderable} child
23921
+ * @param {Renderable|Entity|Sprite|Collectable|Trigger|Draggable|DropTarget|NineSliceSprite|ImageLayer|ColorLayer|Light2d|UIBaseElement|UISpriteElement|UITextButton|Text|BitmapText} child
23911
23922
  * @returns {Renderable} child
23912
23923
  */
23913
23924
  getNextChild(child) {
@@ -23920,7 +23931,7 @@ let globalFloatingCounter = 0;
23920
23931
 
23921
23932
  /**
23922
23933
  * Returns true if contains the specified Child
23923
- * @param {Renderable} child
23934
+ * @param {Renderable|Entity|Sprite|Collectable|Trigger|Draggable|DropTarget|NineSliceSprite|ImageLayer|ColorLayer|Light2d|UIBaseElement|UISpriteElement|UITextButton|Text|BitmapText} child
23924
23935
  * @returns {boolean}
23925
23936
  */
23926
23937
  hasChild(child) {
@@ -24033,10 +24044,9 @@ let globalFloatingCounter = 0;
24033
24044
  }
24034
24045
 
24035
24046
  /**
24036
- * update the bounding box for this shape.
24037
- * @ignore
24038
- * @param {boolean} absolute - update the bounds size and position in (world) absolute coordinates
24039
- * @returns {Bounds} this shape bounding box Rectangle object
24047
+ * update the bounding box for this container.
24048
+ * @param {boolean} [absolute=true] - update the bounds size and position in (world) absolute coordinates
24049
+ * @returns {Bounds} this container bounding box Rectangle object
24040
24050
  */
24041
24051
  updateBounds(absolute = true) {
24042
24052
  let bounds = this.getBounds();
@@ -24047,13 +24057,14 @@ let globalFloatingCounter = 0;
24047
24057
  if (this.enableChildBoundsUpdate === true) {
24048
24058
  this.forEach((child) => {
24049
24059
  if (child.isRenderable) {
24050
- let childBounds = child.getBounds();
24060
+ let childBounds = child.updateBounds(true);
24051
24061
  if (childBounds.isFinite()) {
24052
24062
  bounds.addBounds(childBounds);
24053
24063
  }
24054
24064
  }
24055
24065
  });
24056
24066
  }
24067
+
24057
24068
  return bounds;
24058
24069
  }
24059
24070
 
@@ -24128,7 +24139,7 @@ let globalFloatingCounter = 0;
24128
24139
  /**
24129
24140
  * Invokes the removeChildNow in a defer, to ensure the child is removed safely after the update & draw stack has completed. <br>
24130
24141
  * if the given child implements a onDeactivateEvent() method, that method will be called once the child is removed from this container.
24131
- * @param {Renderable} child
24142
+ * @param {RendRenderable|Sprite|Collectable|Trigger|Draggable|DropTarget|NineSliceSprite|ImageLayer|ColorLayer|Light2d|UIBaseElement|UISpriteElement|UITextButton|Text|BitmapTexterable} child
24132
24143
  * @param {boolean} [keepalive=false] - true to prevent calling child.destroy()
24133
24144
  */
24134
24145
  removeChild(child, keepalive) {
@@ -24144,7 +24155,7 @@ let globalFloatingCounter = 0;
24144
24155
  * Removes (and optionally destroys) a child from the container.<br>
24145
24156
  * (removal is immediate and unconditional)<br>
24146
24157
  * Never use keepalive=true with objects from {@link pool}. Doing so will create a memory leak.
24147
- * @param {Renderable} child
24158
+ * @param {Renderable|Entity|Sprite|Collectable|Trigger|Draggable|DropTarget|NineSliceSprite|ImageLayer|ColorLayer|Light2d|UIBaseElement|UISpriteElement|UITextButton|Text|BitmapText} child
24148
24159
  * @param {boolean} [keepalive=False] - True to prevent calling child.destroy()
24149
24160
  */
24150
24161
  removeChildNow(child, keepalive) {
@@ -24177,16 +24188,14 @@ let globalFloatingCounter = 0;
24177
24188
  child.ancestor = undefined;
24178
24189
  }
24179
24190
 
24180
- // force repaint in case this is a static non-animated object
24181
- if (this.isAttachedToRoot() === true) {
24182
- this.isDirty = true;
24183
- }
24184
-
24185
24191
  // force bounds update if required
24186
24192
  if (this.enableChildBoundsUpdate === true) {
24187
24193
  this.updateBounds();
24188
24194
  }
24189
24195
 
24196
+ // mark the container for repaint
24197
+ this.isDirty = true;
24198
+
24190
24199
  // triggered callback if defined
24191
24200
  this.onChildChange.call(this, childIndex);
24192
24201
  }
@@ -24209,7 +24218,7 @@ let globalFloatingCounter = 0;
24209
24218
 
24210
24219
  /**
24211
24220
  * Move the child in the group one step forward (z depth).
24212
- * @param {Renderable} child
24221
+ * @param {Renderable|Entity|Sprite|Collectable|Trigger|Draggable|DropTarget|NineSliceSprite|ImageLayer|ColorLayer|Light2d|UIBaseElement|UISpriteElement|UITextButton|Text|BitmapText} child
24213
24222
  */
24214
24223
  moveUp(child) {
24215
24224
  let childIndex = this.getChildIndex(child);
@@ -24223,7 +24232,7 @@ let globalFloatingCounter = 0;
24223
24232
 
24224
24233
  /**
24225
24234
  * Move the child in the group one step backward (z depth).
24226
- * @param {Renderable} child
24235
+ * @param {Renderable|Entity|Sprite|Collectable|Trigger|Draggable|DropTarget|NineSliceSprite|ImageLayer|ColorLayer|Light2d|UIBaseElement|UISpriteElement|UITextButton|Text|BitmapText} child
24227
24236
  */
24228
24237
  moveDown(child) {
24229
24238
  let childIndex = this.getChildIndex(child);
@@ -24237,7 +24246,7 @@ let globalFloatingCounter = 0;
24237
24246
 
24238
24247
  /**
24239
24248
  * Move the specified child to the top(z depth).
24240
- * @param {Renderable} child
24249
+ * @param {Renderable|Entity|Sprite|Collectable|Trigger|Draggable|DropTarget|NineSliceSprite|ImageLayer|ColorLayer|Light2d|UIBaseElement|UISpriteElement|UITextButton|Text|BitmapText} child
24241
24250
  */
24242
24251
  moveToTop(child) {
24243
24252
  let childIndex = this.getChildIndex(child);
@@ -24254,7 +24263,7 @@ let globalFloatingCounter = 0;
24254
24263
 
24255
24264
  /**
24256
24265
  * Move the specified child the bottom (z depth).
24257
- * @param {Renderable} child
24266
+ * @param {Renderable|Entity|Sprite|Collectable|Trigger|Draggable|DropTarget|NineSliceSprite|ImageLayer|ColorLayer|Light2d|UIBaseElement|UISpriteElement|UITextButton|Text|BitmapText} child
24258
24267
  */
24259
24268
  moveToBottom(child) {
24260
24269
  let childIndex = this.getChildIndex(child);
@@ -24476,6 +24485,7 @@ let globalFloatingCounter = 0;
24476
24485
 
24477
24486
  /* eslint-disable no-unused-vars */
24478
24487
 
24488
+
24479
24489
  /**
24480
24490
  * @classdesc
24481
24491
  * The map renderer base class
@@ -25200,7 +25210,7 @@ const offsetsStaggerY = [
25200
25210
  let nearest = 0;
25201
25211
  let minDist = Number.MAX_VALUE;
25202
25212
  for (let i = 0; i < 4; ++i) {
25203
- let dc = this.centers[i].sub(rel).length2();
25213
+ const dc = this.centers[i].sub(rel).length2();
25204
25214
  if (dc < minDist) {
25205
25215
  minDist = dc;
25206
25216
  nearest = i;
@@ -26759,8 +26769,9 @@ function onLoadingError(res) {
26759
26769
  * an asset definition to be used with the loader
26760
26770
  * @typedef {object} loader.Asset
26761
26771
  * @property {string} name - name of the asset
26762
- * @property {string} type - the type of the asset : "audio", binary", "image", "json","js", "tmx", "tsx", "fontface"
26763
- * @property {string} src - path and/or file name of the resource (for audio assets only the path is required)
26772
+ * @property {string} type - the type of the asset : "audio", binary", "image", "json", "js", "tmx", "tmj", "tsx", "tsj", "fontface"
26773
+ * @property {string} [src] - path and/or file name of the resource (for audio assets only the path is required)
26774
+ * @property {string} [data] - TMX data if not provided through a src url
26764
26775
  * @property {boolean} [stream] - Set to true to force HTML5 Audio, which allows not to wait for large file to be downloaded before playing.
26765
26776
  * @see loader.preload
26766
26777
  * @see loader.load
@@ -28678,7 +28689,7 @@ var timer$1 = timer;
28678
28689
  */
28679
28690
  class Body {
28680
28691
  /**
28681
- * @param {Renderable} ancestor - the parent object this body is attached to
28692
+ * @param {Renderable|Container|Entity|Sprite|NineSliceSprite} ancestor - the parent object this body is attached to
28682
28693
  * @param {Rect|Rect[]|Polygon|Polygon[]|Line|Line[]|Ellipse|Ellipse[]|Point|Point[]|Bounds|Bounds[]|object} [shapes] - a initial shape, list of shapes, or JSON object defining the body
28683
28694
  * @param {Function} [onBodyUpdate] - callback for when the body is updated (e.g. add/remove shapes)
28684
28695
  */
@@ -28688,7 +28699,7 @@ var timer$1 = timer;
28688
28699
  * a reference to the parent object that contains this body,
28689
28700
  * or undefined if it has not been added to one.
28690
28701
  * @public
28691
- * @type {Renderable}
28702
+ * @type {Renderable|Container|Entity|Sprite|NineSliceSprite}
28692
28703
  * @default undefined
28693
28704
  */
28694
28705
  this.ancestor = ancestor;
@@ -32347,7 +32358,7 @@ class CanvasTexture {
32347
32358
  * the rendering context of this CanvasTexture
32348
32359
  * @type {CanvasRenderingContext2D}
32349
32360
  */
32350
- this.context = this.canvas.getContext("2d", { willReadFrequently: attributes.willReadFrequently });
32361
+ this.context = this.canvas.getContext(attributes.context, { willReadFrequently: attributes.willReadFrequently });
32351
32362
 
32352
32363
  // enable or disable antiAlias if specified
32353
32364
  this.setAntiAlias(attributes.antiAlias);
@@ -33181,7 +33192,7 @@ class CanvasTexture {
33181
33192
 
33182
33193
  /**
33183
33194
  * UI base elements use screen coordinates by default
33184
- * (Note: any child elements added to a UIBaseElement should set their floating property to false)
33195
+ * (Note: any child elements added to a UIBaseElement should have their floating property to false)
33185
33196
  * @see Renderable.floating
33186
33197
  * @type {boolean}
33187
33198
  * @default true
@@ -33193,6 +33204,9 @@ class CanvasTexture {
33193
33204
 
33194
33205
  // enable event detection
33195
33206
  this.isKinematic = false;
33207
+
33208
+ // update container and children bounds automatically
33209
+ this.enableChildBoundsUpdate = true;
33196
33210
  }
33197
33211
 
33198
33212
  /**
@@ -33227,7 +33241,7 @@ class CanvasTexture {
33227
33241
  * @returns {boolean} return false if we need to stop propagating the event
33228
33242
  */
33229
33243
  onClick(event) { // eslint-disable-line no-unused-vars
33230
- return false;
33244
+ return true;
33231
33245
  }
33232
33246
 
33233
33247
  /**
@@ -33320,7 +33334,7 @@ class CanvasTexture {
33320
33334
  * @returns {boolean} return false if we need to stop propagating the event
33321
33335
  */
33322
33336
  onRelease() {
33323
- return false;
33337
+ return true;
33324
33338
  }
33325
33339
 
33326
33340
  /**
@@ -33771,7 +33785,7 @@ const toPX = [12, 24, 0.75, 1];
33771
33785
  setContextStyle(context, this);
33772
33786
 
33773
33787
  for (let i = 0; i < text.length; i++) {
33774
- let string = text[i].trimEnd();
33788
+ const string = text[i].trimEnd();
33775
33789
  // draw the string
33776
33790
  if (this.fillStyle.alpha > 0) {
33777
33791
  context.fillText(string, x, y);
@@ -34200,7 +34214,7 @@ const toPX = [12, 24, 0.75, 1];
34200
34214
  }
34201
34215
 
34202
34216
  if (absolute === true) {
34203
- if (typeof this.ancestor !== "undefined" && typeof this.ancestor.addChild === "function" && this.floating !== true) {
34217
+ if (typeof this.ancestor !== "undefined" && typeof this.ancestor.getAbsolutePosition === "function" && this.floating !== true) {
34204
34218
  bounds.translate(this.ancestor.getAbsolutePosition());
34205
34219
  }
34206
34220
  }
@@ -34279,7 +34293,7 @@ const toPX = [12, 24, 0.75, 1];
34279
34293
 
34280
34294
  for (let i = 0; i < this._text.length; i++) {
34281
34295
  x = lX;
34282
- let string = this._text[i].trimEnd();
34296
+ const string = this._text[i].trimEnd();
34283
34297
  // adjust x pos based on alignment value
34284
34298
  let stringWidth = this.metrics.lineWidth(string);
34285
34299
  switch (this.textAlign) {
@@ -34589,7 +34603,13 @@ const toPX = [12, 24, 0.75, 1];
34589
34603
  this.holdTimeout = -1;
34590
34604
  this.released = true;
34591
34605
 
34592
- // GUI items use screen coordinates
34606
+ /**
34607
+ * if this UISpriteElement should use screen coordinates or local coordinates
34608
+ * (Note: any UISpriteElement elements added to a floating parent container should have their floating property to false)
34609
+ * @see Renderable.floating
34610
+ * @type {boolean}
34611
+ * @default true
34612
+ */
34593
34613
  this.floating = true;
34594
34614
 
34595
34615
  // enable event detection
@@ -34910,7 +34930,7 @@ const toPX = [12, 24, 0.75, 1];
34910
34930
  * @name onCollision
34911
34931
  * @memberof Trigger
34912
34932
  * @param {ResponseObject} response - the collision response object
34913
- * @param {Renderable} other - the other renderable touching this one (a reference to response.a or response.b)
34933
+ * @param {Renderable|Container|Entity|Sprite|NineSliceSprite} other - the other renderable touching this one (a reference to response.a or response.b)
34914
34934
  * @returns {boolean} true if the object should respond to the collision (its position and velocity will be corrected)
34915
34935
  */
34916
34936
  onCollision(response, other) { // eslint-disable-line no-unused-vars
@@ -35527,6 +35547,7 @@ class DropTarget extends Renderable {
35527
35547
  * Available under the MIT License - https://github.com/jriecken/sat-js
35528
35548
  */
35529
35549
 
35550
+
35530
35551
  /**
35531
35552
  * Constants for Vornoi regions
35532
35553
  * @ignore
@@ -35580,7 +35601,7 @@ function flattenPointsOn(points, normal, result) {
35580
35601
  let len = points.length;
35581
35602
  for (let i = 0; i < len; i++) {
35582
35603
  // The magnitude of the projection of the point onto the normal
35583
- let dot = points[i].dot(normal);
35604
+ const dot = points[i].dot(normal);
35584
35605
  if (dot < min) { min = dot; }
35585
35606
  if (dot > max) { max = dot; }
35586
35607
  }
@@ -35709,9 +35730,9 @@ function vornoiRegion(line, point) {
35709
35730
  /**
35710
35731
  * Checks whether polygons collide.
35711
35732
  * @ignore
35712
- * @param {Renderable} a - a reference to the object A.
35733
+ * @param {Renderable|Container|Entity|Sprite|NineSliceSprite} a - a reference to the object A.
35713
35734
  * @param {Polygon} polyA - a reference to the object A Polygon to be tested
35714
- * @param {Renderable} b - a reference to the object B.
35735
+ * @param {Renderable|Container|Entity|Sprite|NineSliceSprite} b - a reference to the object B.
35715
35736
  * @param {Polygon} polyB - a reference to the object B Polygon to be tested
35716
35737
  * @param {Response=} response - Response object (optional) that will be populated if they intersect.
35717
35738
  * @returns {boolean} true if they intersect, false if they don't.
@@ -35763,9 +35784,9 @@ function testPolygonPolygon(a, polyA, b, polyB, response) {
35763
35784
  /**
35764
35785
  * Check if two Ellipse collide.
35765
35786
  * @ignore
35766
- * @param {Renderable} a - a reference to the object A.
35787
+ * @param {Renderable|Container|Entity|Sprite|NineSliceSprite} a - a reference to the object A.
35767
35788
  * @param {Ellipse} ellipseA - a reference to the object A Ellipse to be tested
35768
- * @param {Renderable} b - a reference to the object B.
35789
+ * @param {Renderable|Container|Entity|Sprite|NineSliceSprite} b - a reference to the object B.
35769
35790
  * @param {Ellipse} ellipseB - a reference to the object B Ellipse to be tested
35770
35791
  * @param {Response=} response - Response object (optional) that will be populated if
35771
35792
  * the circles intersect.
@@ -35804,9 +35825,9 @@ function testEllipseEllipse(a, ellipseA, b, ellipseB, response) {
35804
35825
  /**
35805
35826
  * Check if a polygon and an ellipse collide.
35806
35827
  * @ignore
35807
- * @param {Renderable} a - a reference to the object A.
35828
+ * @param {Renderable|Container|Entity|Sprite|NineSliceSprite} a - a reference to the object A.
35808
35829
  * @param {Polygon} polyA - a reference to the object A Polygon to be tested
35809
- * @param {Renderable} b - a reference to the object B.
35830
+ * @param {Renderable|Container|Entity|Sprite|NineSliceSprite} b - a reference to the object B.
35810
35831
  * @param {Ellipse} ellipseB - a reference to the object B Ellipse to be tested
35811
35832
  * @param {Response=} response - Response object (optional) that will be populated if they intersect.
35812
35833
  * @returns {boolean} true if they intersect, false if they don't.
@@ -35827,8 +35848,8 @@ function testPolygonEllipse(a, polyA, b, ellipseB, response) {
35827
35848
 
35828
35849
  // For each edge in the polygon:
35829
35850
  for (let i = 0; i < len; i++) {
35830
- let next = i === len - 1 ? 0 : i + 1;
35831
- let prev = i === 0 ? len - 1 : i - 1;
35851
+ const next = i === len - 1 ? 0 : i + 1;
35852
+ const prev = i === 0 ? len - 1 : i - 1;
35832
35853
  let overlap = 0;
35833
35854
  let overlapN = null;
35834
35855
 
@@ -35970,9 +35991,9 @@ function testPolygonEllipse(a, polyA, b, ellipseB, response) {
35970
35991
  * **NOTE:** This is slightly less efficient than testPolygonEllipse as it just
35971
35992
  * runs testPolygonEllipse and reverses the response at the end.
35972
35993
  * @ignore
35973
- * @param {Renderable} a - a reference to the object A.
35994
+ * @param {Renderable|Container|Entity|Sprite|NineSliceSprite} a - a reference to the object A.
35974
35995
  * @param {Ellipse} ellipseA - a reference to the object A Ellipse to be tested
35975
- * @param {Renderable} b - a reference to the object B.
35996
+ * @param {Renderable|Container|Entity|Sprite|NineSliceSprite} b - a reference to the object B.
35976
35997
  * @param {Polygon} polyB - a reference to the object B Polygon to be tested
35977
35998
  * @param {Response=} response - Response object (optional) that will be populated if
35978
35999
  * they intersect.
@@ -36087,8 +36108,8 @@ class Detector {
36087
36108
  /**
36088
36109
  * determine if two objects should collide (based on both respective objects body collision mask and type).<br>
36089
36110
  * you can redefine this function if you need any specific rules over what should collide with what.
36090
- * @param {Renderable} a - a reference to the object A.
36091
- * @param {Renderable} b - a reference to the object B.
36111
+ * @param {Renderable|Container|Entity|Sprite|NineSliceSprite} a - a reference to the object A.
36112
+ * @param {Renderable|Container|Entity|Sprite|NineSliceSprite} b - a reference to the object B.
36092
36113
  * @returns {boolean} true if they should collide, false otherwise
36093
36114
  */
36094
36115
  shouldCollide(a, b) {
@@ -36141,7 +36162,7 @@ class Detector {
36141
36162
  /**
36142
36163
  * find all the collisions for the specified object using a broadphase algorithm
36143
36164
  * @ignore
36144
- * @param {Renderable} objA - object to be tested for collision
36165
+ * @param {Renderable|Container|Entity|Sprite|NineSliceSprite} objA - object to be tested for collision
36145
36166
  * @returns {boolean} in case of collision, false otherwise
36146
36167
  */
36147
36168
  collisions(objA) {
@@ -36217,7 +36238,7 @@ class Detector {
36217
36238
  if (objB.body && line.getBounds().overlaps(objB.getBounds())) {
36218
36239
 
36219
36240
  // go trough all defined shapes in B (if any)
36220
- let bLen = objB.body.shapes.length;
36241
+ const bLen = objB.body.shapes.length;
36221
36242
  if ( objB.body.shapes.length === 0) {
36222
36243
  continue;
36223
36244
  }
@@ -37348,11 +37369,8 @@ function createDefaultParticleTexture(w = 8, h = 8) {
37348
37369
  }
37349
37370
 
37350
37371
  if (absolute === true) {
37351
- bounds.centerOn(this.pos.x + bounds.x + bounds.width / 2, this.pos.y + bounds.y + bounds.height / 2);
37352
- if (typeof this.ancestor !== "undefined" && typeof this.ancestor.addChild === "function" && this.floating !== true) {
37353
- bounds.translate(this.ancestor.getAbsolutePosition());
37354
- }
37355
-
37372
+ var absPos = this.getAbsolutePosition();
37373
+ bounds.centerOn(absPos.x + bounds.x + bounds.width / 2, absPos.y + bounds.y + bounds.height / 2);
37356
37374
  }
37357
37375
 
37358
37376
  return bounds;
@@ -37992,10 +38010,10 @@ class BasePlugin {
37992
38010
  * this can be overridden by the plugin
37993
38011
  * @public
37994
38012
  * @type {string}
37995
- * @default "15.1.4"
38013
+ * @default "15.1.6"
37996
38014
  * @name plugin.Base#version
37997
38015
  */
37998
- this.version = "15.1.4";
38016
+ this.version = "15.1.6";
37999
38017
  }
38000
38018
  }
38001
38019
 
@@ -38223,7 +38241,7 @@ Renderer.prototype.getScreenContext = function() {
38223
38241
  * @name version
38224
38242
  * @type {string}
38225
38243
  */
38226
- const version = "15.1.4";
38244
+ const version = "15.1.6";
38227
38245
 
38228
38246
  /**
38229
38247
  * a flag indicating that melonJS is fully initialized