The Tween.onStart signal wasn't dispatched if the Tween had a delay set. It's now dispatched immediately if no delay, or after the delay if set. It also respects the autoStart parameter and will still dispatch even if autoStart is true.

This commit is contained in:
photonstorm 2015-04-27 14:00:11 +01:00
parent 5d680ce4d4
commit 8519c9e394
2 changed files with 12 additions and 2 deletions

View file

@ -315,6 +315,7 @@ Version 2.4 - "Katar" - in dev
* Fixed bug in Pixi where RenderTexture.render would ignore the given matrix.
* Fixed a bug in Pixi where drawing a Sprite to a RenderTexture would reset the Sprites transform to an identity Matrix.
* The SoundManager didn't accurately detect devices or browser environments with no sound card present and would try to carry on using a null Web Audio context (thanks @englercj #1746)
* The Tween.onStart signal wasn't dispatched if the Tween had a delay set. It's now dispatched immediately if no delay, or after the delay if set. It also respects the `autoStart` parameter and will still dispatch even if `autoStart` is true.
For changes in previous releases please see the extensive [Version History](https://github.com/photonstorm/phaser/blob/master/CHANGELOG.md).

View file

@ -161,6 +161,11 @@ Phaser.Tween = function (target, game, manager) {
*/
this._codePaused = false;
/**
* @property {boolean} _hasStarted - Internal var to track if the Tween has started yet or not.
* @private
*/
this._hasStarted = false;
};
Phaser.Tween.prototype = {
@ -311,8 +316,6 @@ Phaser.Tween.prototype = {
this.timeline[this.current].start();
this.onStart.dispatch(this.target, this);
return this;
},
@ -727,6 +730,12 @@ Phaser.Tween.prototype = {
}
else if (status === Phaser.TweenData.RUNNING)
{
if (!this._hasStarted)
{
this.onStart.dispatch(this.target, this);
this._hasStarted = true;
}
if (this._onUpdateCallback !== null)
{
this._onUpdateCallback.call(this._onUpdateCallbackContext, this, this.timeline[this.current].value, this.timeline[this.current]);