mirror of
https://github.com/photonstorm/phaser
synced 2024-11-22 20:53:39 +00:00
Tween.restart
wouldn't restart the tween properly. Fix #4594
This commit is contained in:
parent
d71529b4c0
commit
8f22f37dca
2 changed files with 19 additions and 9 deletions
|
@ -159,6 +159,7 @@ The following changes took place in the Pointer class:
|
|||
* The `Arcade.StaticBody.setSize` arguments have changed from `(width, height, offsetX, offsetY)` to `(width, height, center)`. They now match Dynamic Body setSize and the Size Component method (thanks @samme)
|
||||
* When enabling Arcade Physics Body debug it will now draw only the faces marked for collision, allowing you to easily see if a face is disabled or not (thanks @BdR76)
|
||||
* `Transform.getParentRotation` is a new method available to all GameObjects that will return the sum total rotation of all of the Game Objects parent Containers, if it has any.
|
||||
* `Tween.restart` now sets the Tween properties `elapsed`, `progress`, `totalElapsed` and `totalProgress` to zero when called, rather than adding to existing values should the tween already be running.
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
|
@ -181,6 +182,7 @@ The following changes took place in the Pointer class:
|
|||
* `Arcade.StaticBody.setSize` now centers the body correctly, as with the other similar methods. Fix #4213 (thanks @samme)
|
||||
* Setting `random: false` in a Particle Emitter config option no longer causes it to think random is true (thanks @samme)
|
||||
* `Zone.setSize` didn't update the displayOrigin, causing touch events to be inaccurate as the origin was out. Fix #4131 (thanks @rexrainbow)
|
||||
* `Tween.restart` wouldn't restart the tween properly. Fix #4594 (thanks @NokFrt)
|
||||
|
||||
### Examples, Documentation and TypeScript
|
||||
|
||||
|
|
|
@ -419,23 +419,31 @@ var Tween = new Class({
|
|||
*/
|
||||
restart: function ()
|
||||
{
|
||||
if (this.state === TWEEN_CONST.PENDING_ADD)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
// Reset these so they're ready for the next update
|
||||
this.elapsed = 0;
|
||||
this.progress = 0;
|
||||
this.totalElapsed = 0;
|
||||
this.totalProgress = 0;
|
||||
|
||||
if (this.state === TWEEN_CONST.REMOVED)
|
||||
if (this.state === TWEEN_CONST.ACTIVE)
|
||||
{
|
||||
return this.seek(0);
|
||||
}
|
||||
else if (this.state === TWEEN_CONST.REMOVED)
|
||||
{
|
||||
this.seek(0);
|
||||
this.parent.makeActive(this);
|
||||
|
||||
return this;
|
||||
}
|
||||
else if (this.state === TWEEN_CONST.PENDING_ADD)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.stop();
|
||||
this.play();
|
||||
return this.play();
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue