onPreRenderCallback wasn't being cleared on a State swap.

This commit is contained in:
photonstorm 2014-11-26 12:56:19 +00:00
parent fc457f5aca
commit fb733ddcca
2 changed files with 7 additions and 5 deletions

View file

@ -251,6 +251,7 @@ This fixes a bug in FF where it would use the default DOMMouseWheel (thanks @pns
* When you change State the P2 Physics world is no longer fully cleared. All of the bodies, springs, fixtures, materials and constraints are removed - but config settings such as gravity, restitution, the contact solver, etc are all retained. The P2.World object is only created the very first time you call Physics.startSystem. Every subsequent call hits P2.World.reset instead. This fixes "P2.World gravity broken after switching states" (and other related issues) (#1292 #1289 #1176)
* Text.lineSpacing works correctly again. Before no space was added between the lines (thanks @intimidate #1367 and @brejep #1366)
* P2.BodyDebug always lagged behind the position of the Body it was tracking by one frame, which became visible at high speeds. It now syncs its position in the Body.postUpdate which prevents this from happening (thanks @valueerror)
* A State.preRender callback wan't removed correctly when switching States.
### Pixi 2.1.0 New Features

View file

@ -97,7 +97,7 @@ Phaser.StateManager = function (game, pendingState) {
this.onResizeCallback = null;
/**
* @property {function} onPreRenderCallback - This is called before the state is rendered and before the stage is cleared.
* @property {function} onPreRenderCallback - This is called before the state is rendered and before the stage is cleared but after all game objects have had their final properties adjusted.
*/
this.onPreRenderCallback = null;
@ -225,6 +225,7 @@ Phaser.StateManager.prototype = {
this.onLoadUpdateCallback = null;
this.onCreateCallback = null;
this.onUpdateCallback = null;
this.onPreRenderCallback = null;
this.onRenderCallback = null;
this.onResizeCallback = null;
this.onPausedCallback = null;
@ -427,10 +428,10 @@ Phaser.StateManager.prototype = {
{
var valid = false;
if (this.states[key]['preload']) { valid = true; }
if (this.states[key]['create']) { valid = true; }
if (this.states[key]['update']) { valid = true; }
if (this.states[key]['render']) { valid = true; }
if (this.states[key]['preload'] || this.states[key]['create'] || this.states[key]['update'] || this.states[key]['render'])
{
valid = true;
}
if (valid === false)
{