Tween.onLoop would be fired when a Tween repeated and Tween.onRepeat would be fired when a Tween looped. These are now reversed to fire correctly (thanks @vladkens #2024)

This commit is contained in:
Richard Davey 2016-02-17 02:57:45 +00:00
parent 071d9cffd0
commit 15411f1e56
2 changed files with 12 additions and 4 deletions

View file

@ -378,6 +378,7 @@ You can read all about the philosophy behind Lazer [here](http://phaser.io/news/
* ctrl + click is now only considered a right-click if event.buttons = 1, this should allow you to use ctrl as a key modifier on Windows (and any device with a multi-button mouse attached) and still use ctrl + click on OS X / trackpads for a right-click (thanks @yuvalsv #2167) * ctrl + click is now only considered a right-click if event.buttons = 1, this should allow you to use ctrl as a key modifier on Windows (and any device with a multi-button mouse attached) and still use ctrl + click on OS X / trackpads for a right-click (thanks @yuvalsv #2167)
* If the Mouse was over a Sprite and you then clicked it, it would dispatch another Over event. This is now surpressed if the Over event has already been dispatched previously (thanks @McFarts #2133) * If the Mouse was over a Sprite and you then clicked it, it would dispatch another Over event. This is now surpressed if the Over event has already been dispatched previously (thanks @McFarts #2133)
* InputHandler.pointerOver could fail to return anything in some instances, now always returns a boolean. * InputHandler.pointerOver could fail to return anything in some instances, now always returns a boolean.
* Tween.onLoop would be fired when a Tween repeated and Tween.onRepeat would be fired when a Tween looped. These are now reversed to fire correctly (thanks @vladkens #2024)
### Pixi Updates ### Pixi Updates

View file

@ -198,7 +198,7 @@ Phaser.Tween.prototype = {
* @param {function|string} [ease=null] - Easing function. If not set it will default to Phaser.Easing.Default, which is Phaser.Easing.Linear.None by default but can be over-ridden. * @param {function|string} [ease=null] - Easing function. If not set it will default to Phaser.Easing.Default, which is Phaser.Easing.Linear.None by default but can be over-ridden.
* @param {boolean} [autoStart=false] - Set to `true` to allow this tween to start automatically. Otherwise call Tween.start(). * @param {boolean} [autoStart=false] - Set to `true` to allow this tween to start automatically. Otherwise call Tween.start().
* @param {number} [delay=0] - Delay before this tween will start in milliseconds. Defaults to 0, no delay. * @param {number} [delay=0] - Delay before this tween will start in milliseconds. Defaults to 0, no delay.
* @param {number} [repeat=0] - Should the tween automatically restart once complete? If you want it to run forever set as -1. This only effects this induvidual tween, not any chained tweens. * @param {number} [repeat=0] - Should the tween automatically restart once complete? If you want it to run forever set as -1. This only effects this individual tween, not any chained tweens.
* @param {boolean} [yoyo=false] - A tween that yoyos will reverse itself and play backwards automatically. A yoyo'd tween doesn't fire the Tween.onComplete event, so listen for Tween.onLoop instead. * @param {boolean} [yoyo=false] - A tween that yoyos will reverse itself and play backwards automatically. A yoyo'd tween doesn't fire the Tween.onComplete event, so listen for Tween.onLoop instead.
* @return {Phaser.Tween} This Tween object. * @return {Phaser.Tween} This Tween object.
*/ */
@ -245,7 +245,7 @@ Phaser.Tween.prototype = {
* @param {function|string} [ease=null] - Easing function. If not set it will default to Phaser.Easing.Default, which is Phaser.Easing.Linear.None by default but can be over-ridden. * @param {function|string} [ease=null] - Easing function. If not set it will default to Phaser.Easing.Default, which is Phaser.Easing.Linear.None by default but can be over-ridden.
* @param {boolean} [autoStart=false] - Set to `true` to allow this tween to start automatically. Otherwise call Tween.start(). * @param {boolean} [autoStart=false] - Set to `true` to allow this tween to start automatically. Otherwise call Tween.start().
* @param {number} [delay=0] - Delay before this tween will start in milliseconds. Defaults to 0, no delay. * @param {number} [delay=0] - Delay before this tween will start in milliseconds. Defaults to 0, no delay.
* @param {number} [repeat=0] - Should the tween automatically restart once complete? If you want it to run forever set as -1. This only effects this induvidual tween, not any chained tweens. * @param {number} [repeat=0] - Should the tween automatically restart once complete? If you want it to run forever set as -1. This only effects this individual tween, not any chained tweens.
* @param {boolean} [yoyo=false] - A tween that yoyos will reverse itself and play backwards automatically. A yoyo'd tween doesn't fire the Tween.onComplete event, so listen for Tween.onLoop instead. * @param {boolean} [yoyo=false] - A tween that yoyos will reverse itself and play backwards automatically. A yoyo'd tween doesn't fire the Tween.onComplete event, so listen for Tween.onLoop instead.
* @return {Phaser.Tween} This Tween object. * @return {Phaser.Tween} This Tween object.
*/ */
@ -762,8 +762,15 @@ Phaser.Tween.prototype = {
return this.isRunning; return this.isRunning;
} }
else if (status === Phaser.TweenData.LOOPED) else if (status === Phaser.TweenData.LOOPED)
{
if (this.repeatCounter === -1)
{ {
this.onLoop.dispatch(this.target, this); this.onLoop.dispatch(this.target, this);
}
else
{
this.onRepeat.dispatch(this.target, this);
}
return true; return true;
} }
else if (status === Phaser.TweenData.COMPLETE) else if (status === Phaser.TweenData.COMPLETE)
@ -798,7 +805,7 @@ Phaser.Tween.prototype = {
if (this.repeatCounter === -1) if (this.repeatCounter === -1)
{ {
this.timeline[this.current].start(); this.timeline[this.current].start();
this.onRepeat.dispatch(this.target, this); this.onLoop.dispatch(this.target, this);
return true; return true;
} }
else if (this.repeatCounter > 0) else if (this.repeatCounter > 0)