melonjs 9.1.1 → 9.1.2

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 - v9.1.1
2
+ * melonJS Game Engine - v9.1.2
3
3
  * http://www.melonjs.org
4
4
  * melonjs is licensed under the MIT License.
5
5
  * http://www.opensource.org/licenses/mit-license
@@ -10681,6 +10681,37 @@
10681
10681
  return this;
10682
10682
  },
10683
10683
 
10684
+ /**
10685
+ * Shifts the Polygon to the given position vector.
10686
+ * @name shift
10687
+ * @memberOf me.Polygon
10688
+ * @function
10689
+ * @param {me.Vector2d} position
10690
+ */
10691
+ /**
10692
+ * Shifts the Polygon to the given x, y position.
10693
+ * @name shift
10694
+ * @memberOf me.Polygon
10695
+ * @function
10696
+ * @param {Number} x
10697
+ * @param {Number} y
10698
+ */
10699
+ shift: function shift() {
10700
+ var _x, _y;
10701
+ if (arguments.length === 2) {
10702
+ // x, y
10703
+ _x = arguments[0];
10704
+ _y = arguments[1];
10705
+ } else {
10706
+ // vector
10707
+ _x = arguments[0].x;
10708
+ _y = arguments[0].y;
10709
+ }
10710
+ this.pos.x = _x;
10711
+ this.pos.y = _y;
10712
+ this.updateBounds();
10713
+ },
10714
+
10684
10715
  /**
10685
10716
  * Returns true if the polygon contains the given point.
10686
10717
  * (Note: it is highly recommended to first do a hit test on the corresponding <br>
@@ -10892,67 +10923,6 @@
10892
10923
  return this.setShape(rect.pos.x, rect.pos.y, rect.width, rect.height);
10893
10924
  },
10894
10925
 
10895
- /**
10896
- * translate the rect by the specified offset
10897
- * @name translate
10898
- * @memberOf me.Rect.prototype
10899
- * @function
10900
- * @param {Number} x x offset
10901
- * @param {Number} y y offset
10902
- * @return {me.Rect} this rectangle
10903
- */
10904
- /**
10905
- * translate the rect by the specified vector
10906
- * @name translate
10907
- * @memberOf me.Rect.prototype
10908
- * @function
10909
- * @param {me.Vector2d} v vector offset
10910
- * @return {me.Rect} this rectangle
10911
- */
10912
- translate : function () {
10913
- var _x, _y;
10914
-
10915
- if (arguments.length === 2) {
10916
- // x, y
10917
- _x = arguments[0];
10918
- _y = arguments[1];
10919
- } else {
10920
- // vector
10921
- _x = arguments[0].x;
10922
- _y = arguments[0].y;
10923
- }
10924
-
10925
- this.pos.x += _x;
10926
- this.pos.y += _y;
10927
-
10928
- return this;
10929
- },
10930
-
10931
- /**
10932
- * Shifts the rect to the given position vector.
10933
- * @name shift
10934
- * @memberOf me.Rect
10935
- * @function
10936
- * @param {me.Vector2d} position
10937
- */
10938
- /**
10939
- * Shifts the rect to the given x, y position.
10940
- * @name shift
10941
- * @memberOf me.Rect
10942
- * @function
10943
- * @param {Number} x
10944
- * @param {Number} y
10945
- */
10946
- shift : function () {
10947
- if (arguments.length === 2) {
10948
- // x, y
10949
- this.pos.set(arguments[0], arguments[1]);
10950
- } else {
10951
- // vector
10952
- this.pos.setV(arguments[0]);
10953
- }
10954
- },
10955
-
10956
10926
  /**
10957
10927
  * merge this rectangle with another one
10958
10928
  * @name union
@@ -28404,16 +28374,16 @@
28404
28374
  }
28405
28375
 
28406
28376
  // set pause/stop action on losing focus
28407
- window.addEventListener("blur", function () {
28377
+ window.addEventListener("blur", (function () {
28408
28378
  if (this.stopOnBlur) {
28409
28379
  state$1.stop(true);
28410
28380
  }
28411
28381
  if (this.pauseOnBlur) {
28412
28382
  state$1.pause(true);
28413
28383
  }
28414
- }, false);
28384
+ }).bind(this), false);
28415
28385
  // set restart/resume action on gaining focus
28416
- window.addEventListener("focus", function () {
28386
+ window.addEventListener("focus", (function () {
28417
28387
  if (this.stopOnBlur) {
28418
28388
  state$1.restart(true);
28419
28389
  }
@@ -28424,7 +28394,7 @@
28424
28394
  if (this.autoFocus) {
28425
28395
  this.focus();
28426
28396
  }
28427
- }, false);
28397
+ }).bind(this), false);
28428
28398
 
28429
28399
 
28430
28400
  // Set the name of the hidden property and the change event for visibility
@@ -28448,7 +28418,7 @@
28448
28418
  if (typeof (visibilityChange) === "string") {
28449
28419
  // add the corresponding event listener
28450
28420
  document.addEventListener(visibilityChange,
28451
- function () {
28421
+ (function () {
28452
28422
  if (document[hidden]) {
28453
28423
  if (this.stopOnBlur) {
28454
28424
  state$1.stop(true);
@@ -28464,7 +28434,7 @@
28464
28434
  state$1.resume(true);
28465
28435
  }
28466
28436
  }
28467
- }, false
28437
+ }).bind(this), false
28468
28438
  );
28469
28439
  }
28470
28440
  },
@@ -32519,10 +32489,10 @@
32519
32489
  * this can be overridden by the plugin
32520
32490
  * @public
32521
32491
  * @type String
32522
- * @default "9.1.1"
32492
+ * @default "9.1.2"
32523
32493
  * @name me.plugin.Base#version
32524
32494
  */
32525
- this.version = "9.1.1";
32495
+ this.version = "9.1.2";
32526
32496
  }
32527
32497
  }),
32528
32498
 
@@ -36773,7 +36743,7 @@
36773
36743
  * @name version
36774
36744
  * @type {string}
36775
36745
  */
36776
- var version = "9.1.1";
36746
+ var version = "9.1.2";
36777
36747
 
36778
36748
 
36779
36749
  /**