Skip to content

Commit 6979103

Browse files
committed
Fix for phaserjs#732 (Timer.onComplete not firing).
jsdoc updates across Math and InputHandler.
1 parent b569f92 commit 6979103

4 files changed

Lines changed: 19 additions & 8 deletions

File tree

src/core/Group.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1422,7 +1422,7 @@ Phaser.Group.prototype.remove = function (child, destroy) {
14221422

14231423
if (destroy && removed)
14241424
{
1425-
removed.destroy();
1425+
removed.destroy(true);
14261426
}
14271427

14281428
return true;
@@ -1456,7 +1456,7 @@ Phaser.Group.prototype.removeAll = function (destroy) {
14561456

14571457
if (destroy && removed)
14581458
{
1459-
removed.destroy();
1459+
removed.destroy(true);
14601460
}
14611461
}
14621462
while (this.children.length > 0);
@@ -1501,7 +1501,7 @@ Phaser.Group.prototype.removeBetween = function (startIndex, endIndex, destroy)
15011501

15021502
if (destroy && removed)
15031503
{
1504-
removed.destroy();
1504+
removed.destroy(true);
15051505
}
15061506

15071507
if (this.cursor === this.children[i])

src/input/InputHandler.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ Phaser.InputHandler = function (sprite) {
2929
this.enabled = false;
3030

3131
/**
32-
* @property {number} priorityID - The PriorityID controls which Sprite receives an Input event first if they should overlap.
32+
* The priorityID is used to determine which game objects should get priority when input events occur. For example if you have
33+
* several Sprites that overlap, by default the one at the top of the display list is given priority for input events. You can
34+
* stop this from happening by controlling the priorityID value. The higher the value, the more important they are considered to the Input events.
35+
* @property {number} priorityID
3336
* @default
3437
*/
3538
this.priorityID = 0;

src/math/Math.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -769,15 +769,15 @@ Phaser.Math = {
769769
},
770770

771771
/**
772-
* Keeps an angle value between -180 and +180<br>
773-
* Should be called whenever the angle is updated on the Sprite to stop it from going insane.
772+
* Keeps an angle value between -180 and +180.
774773
*
775774
* @method Phaser.Math#wrapAngle
776775
* @param {number} angle - The angle value to check
777-
* @param {boolean} radians - True if angle sizes are expressed in radians.
776+
* @param {boolean} radians - True if angle is given in radians.
778777
* @return {number} The new angle value, returns the same as the input angle if it was within bounds.
779778
*/
780779
wrapAngle: function (angle, radians) {
780+
781781
var radianFactor = (radians) ? Math.PI / 180 : 1;
782782
return this.wrap(angle, -180 * radianFactor, 180 * radianFactor);
783783

src/time/Timer.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,12 @@ Phaser.Timer = function (game, autoDestroy) {
103103
*/
104104
this._len = 0;
105105

106+
/**
107+
* @property {number} _marked - Temp. counter variable.
108+
* @private
109+
*/
110+
this._marked = 0;
111+
106112
/**
107113
* @property {number} _i - Temp. array counter variable.
108114
* @private
@@ -377,6 +383,7 @@ Phaser.Timer.prototype = {
377383
}
378384

379385
this._now = time;
386+
this._marked = 0;
380387

381388
// Clears events marked for deletion and resets _len and _i to 0.
382389
this.clearPendingEvents();
@@ -408,6 +415,7 @@ Phaser.Timer.prototype = {
408415
}
409416
else
410417
{
418+
this._marked++;
411419
this.events[this._i].pendingDelete = true;
412420
this.events[this._i].callback.apply(this.events[this._i].callbackContext, this.events[this._i].args);
413421
}
@@ -421,7 +429,7 @@ Phaser.Timer.prototype = {
421429
}
422430

423431
// Are there any events left?
424-
if (this.events.length > 0)
432+
if (this.events.length > this._marked)
425433
{
426434
this.order();
427435
}

0 commit comments

Comments
 (0)