Tweens with 'yoyo' set on them couldn't be re-used again because the start and end properties were left in a reversed state. When a yoyo tween ends it now restores the reversed values (thanks @SBCGames #2307)

This commit is contained in:
Richard Davey 2016-02-03 12:24:22 +00:00
parent 1883cfc83b
commit e04504f481
2 changed files with 10 additions and 0 deletions

View file

@ -292,6 +292,7 @@ If you are an exceptional JavaScript developer and would like to join the Phaser
* SoundManager.destroy now calls AudioContext.close (thanks @stoneman1 #2237)
* Sound.onEndedHandler now sets Sound.currentTime to be Sound.durationMS (thanks @stoneman1 #2237)
* BitmapData would always create a private `_swapCanvas` which was a clone of its main canvas used for advanced movement operations. This no longer happens. The swap canvas is created only as needed, by those functions that use it (specifically `moveH` and `moveV`), meaning a BitmapData will now use half the amount of memory it used to, and you'll have half the amount of canvas DOM elements created (unless you make heavy use of the move functions).
* Tweens with 'yoyo' set on them couldn't be re-used again because the start and end properties were left in a reversed state. When a yoyo tween ends it now restores the reversed values (thanks @SBCGames #2307)
### Bug Fixes

View file

@ -494,6 +494,15 @@ Phaser.TweenData.prototype = {
// We're already in reverse mode, which means the yoyo has finished and there's no repeats, so end
if (this.inReverse && this.repeatCounter === 0)
{
// Restore the properties
for (var property in this.vStartCache)
{
this.vStart[property] = this.vStartCache[property];
this.vEnd[property] = this.vEndCache[property];
}
this.inReverse = false;
return Phaser.TweenData.COMPLETE;
}