Skip to content

Commit 0516167

Browse files
committed
Finally tracked down the rogue bug causing Graphics objects to not work with various components (fix phaserjs#1654)
1 parent fe9a9fc commit 0516167

3 files changed

Lines changed: 10 additions & 10 deletions

File tree

src/gameobjects/Graphics.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,18 +60,23 @@ var components = [
6060

6161
Phaser.Component.Core.install.call(Phaser.Graphics.prototype, components);
6262

63+
Phaser.Graphics.prototype.preUpdatePhysics = Phaser.Component.PhysicsBody.preUpdate;
64+
Phaser.Graphics.prototype.preUpdateLifeSpan = Phaser.Component.LifeSpan.preUpdate;
65+
Phaser.Graphics.prototype.preUpdateInWorld = Phaser.Component.InWorld.preUpdate;
66+
Phaser.Graphics.prototype.preUpdateCore = Phaser.Component.Core.preUpdate;
67+
6368
/**
6469
* Automatically called by World.preUpdate.
6570
* @method Phaser.Graphics.prototype.preUpdate
6671
*/
6772
Phaser.Graphics.prototype.preUpdate = function () {
6873

69-
// Phaser.Component.PhysicsBody.preUpdate.call(this);
70-
// Phaser.Component.LifeSpan.preUpdate.call(this);
71-
Phaser.Component.InWorld.preUpdate.call(this);
72-
Phaser.Component.Core.preUpdate.call(this);
74+
if (!this.preUpdatePhysics() || !this.preUpdateLifeSpan() || !this.preUpdateInWorld())
75+
{
76+
return false;
77+
}
7378

74-
return true;
79+
return this.preUpdateCore();
7580

7681
};
7782

src/pixi/display/DisplayObjectContainer.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ PIXI.DisplayObjectContainer = function()
3131
PIXI.DisplayObjectContainer.prototype = Object.create( PIXI.DisplayObject.prototype );
3232
PIXI.DisplayObjectContainer.prototype.constructor = PIXI.DisplayObjectContainer;
3333

34-
3534
/**
3635
* The width of the displayObjectContainer, setting this will actually modify the scale to achieve the value set
3736
*

src/pixi/primitives/Graphics.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,6 @@ PIXI.Graphics = function()
136136
PIXI.Graphics.prototype = Object.create( PIXI.DisplayObjectContainer.prototype );
137137
PIXI.Graphics.prototype.constructor = PIXI.Graphics;
138138

139-
PIXI.Graphics.prototype.preUpdate = function() {};
140-
PIXI.Graphics.prototype.update = function() {};
141-
PIXI.Graphics.prototype.postUpdate = function() {};
142-
143139
/**
144140
* Specifies the line style used for subsequent calls to Graphics methods such as the lineTo() method or the drawCircle() method.
145141
*

0 commit comments

Comments
 (0)