mirror of
https://github.com/photonstorm/phaser
synced 2024-11-27 07:01:20 +00:00
ArraySet.removeAll allows you to remove all members of an ArraySet and optionally call destroy
on them as well.
GameObject.input.dragStartPoint now stores the coordinates the object was at when the drag started. This value is populated when the drag starts. It can be used to return an object to its pre-drag position, for example if it was dropped in an invalid place in-game.
This commit is contained in:
parent
23d31ffc62
commit
5a9b509b44
3 changed files with 38 additions and 0 deletions
|
@ -127,6 +127,8 @@ We've also removed functions and properties from Pixi classes that Phaser doesn'
|
|||
* Sprite.left, Sprite.right, Sprite.top, Sprite.bottom are new properties that contain the totals of the Sprite position and dimensions, adjusted for the anchor.
|
||||
* Sprite.offsetX and Sprite.offsetY contain the offsets from the Sprite.x/y coordinates to the top-left of the Sprite, taking anchor into consideration.
|
||||
* Emitter.flow now works in a slightly different (and more useful!) way. You can now specify a `quantity` and a `total`. The `quantity` controls how many particles are emitted every time the flow frequency is met. The `total` controls how many particles will be emitted in total. You can set `total` to be -1 and it will carry on emitting at the given frequency forever (also fixes #1598 thanks @brianbunch)
|
||||
* ArraySet.removeAll allows you to remove all members of an ArraySet and optionally call `destroy` on them as well.
|
||||
* GameObject.input.dragStartPoint now stores the coordinates the object was at when the drag started. This value is populated when the drag starts. It can be used to return an object to its pre-drag position, for example if it was dropped in an invalid place in-game.
|
||||
|
||||
### Updates
|
||||
|
||||
|
|
|
@ -187,6 +187,11 @@ Phaser.InputHandler = function (sprite) {
|
|||
*/
|
||||
this.dragFromCenter = false;
|
||||
|
||||
/**
|
||||
* @property {Phaser.Point} dragStartPoint - The Point from which the most recent drag started from. Useful if you need to return an object to its starting position.
|
||||
*/
|
||||
this.dragStartPoint = new Phaser.Point();
|
||||
|
||||
/**
|
||||
* @property {Phaser.Point} _dragPoint - Internal cache var.
|
||||
* @private
|
||||
|
@ -1296,6 +1301,7 @@ Phaser.InputHandler.prototype = {
|
|||
this.sprite.bringToTop();
|
||||
}
|
||||
|
||||
this.dragStartPoint.set(x, y);
|
||||
this.sprite.events.onDragStart$dispatch(this.sprite, pointer, x, y);
|
||||
|
||||
},
|
||||
|
|
|
@ -180,6 +180,36 @@ Phaser.ArraySet.prototype = {
|
|||
}
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Removes every member from this ArraySet and optionally destroys it.
|
||||
*
|
||||
* @method Phaser.ArraySet#removeAll
|
||||
* @param {boolean} [destroy=false] - Call `destroy` on each member as it's removed from this set.
|
||||
*/
|
||||
removeAll: function (destroy) {
|
||||
|
||||
if (typeof destroy === 'undefined') { destroy = false; }
|
||||
|
||||
var i = this.list.length;
|
||||
|
||||
while (i--)
|
||||
{
|
||||
if (this.list[i])
|
||||
{
|
||||
var item = this.remove(this.list[i]);
|
||||
|
||||
if (destroy)
|
||||
{
|
||||
item.destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.position = 0;
|
||||
this.list = [];
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue