Skip to content

Commit 6b1895e

Browse files
committed
worldAlpha is now calculated in the read, not in preUpdate all the time.
1 parent f2ca83a commit 6b1895e

4 files changed

Lines changed: 8 additions & 23 deletions

File tree

v3/src/checksum.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
var CHECKSUM = {
2-
build: '33625460-c152-11e6-ae92-d150eb7215ee'
2+
build: 'e9c69930-c6d1-11e6-838b-4b50f0ec04a3'
33
};
44
module.exports = CHECKSUM;

v3/src/components/Color.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,10 @@ Object.defineProperties(Color.prototype, {
146146
{
147147
if (!this._dirty)
148148
{
149+
this._dirty = true;
150+
149151
this.state.sys.updates.add(this);
150152
}
151-
152-
this._dirty = true;
153153
}
154154
else
155155
{
@@ -293,6 +293,11 @@ Object.defineProperties(Color.prototype, {
293293

294294
get: function ()
295295
{
296+
if (this.gameObject.parent)
297+
{
298+
this._worldAlpha = this._alpha * this.gameObject.parent.color.worldAlpha;
299+
}
300+
296301
return this._worldAlpha;
297302
},
298303

v3/src/gameobjects/container/Container.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,6 @@ Container.prototype.constructor = Container;
2525

2626
Container.prototype.preUpdate = function ()
2727
{
28-
if (this.parent)
29-
{
30-
this.color.worldAlpha = this.parent.color.worldAlpha;
31-
}
32-
3328
this.children.preUpdate();
3429
};
3530

v3/src/gameobjects/image/Image.js

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -36,21 +36,6 @@ var Image = function (state, x, y, key, frame)
3636
Image.prototype = Object.create(GameObject.prototype);
3737
Image.prototype.constructor = Image;
3838

39-
/**
40-
* Automatically called by World.preUpdate.
41-
*
42-
* @method Phaser.Image#preUpdate
43-
* @memberof Phaser.Image
44-
*/
45-
Image.prototype.preUpdate = function ()
46-
{
47-
// Would like to get rid of this somehow ...
48-
if (this.parent)
49-
{
50-
this.color.worldAlpha = this.parent.color.worldAlpha;
51-
}
52-
};
53-
5439
Object.defineProperties(Image.prototype, {
5540

5641
width: {

0 commit comments

Comments
 (0)