Skip to content

Commit f0e7a9b

Browse files
committed
The Container Game Object now uses the AlphaSingle component, allowing you to uniformly set the alpha of the container, rather than a quad alpha, which never worked consistently across Container children. Fix phaserjs#4916
1 parent 949d882 commit f0e7a9b

2 files changed

Lines changed: 4 additions & 7 deletions

File tree

src/gameobjects/container/Container.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ var Vector2 = require('../../math/Vector2');
5858
* @constructor
5959
* @since 3.4.0
6060
*
61-
* @extends Phaser.GameObjects.Components.Alpha
61+
* @extends Phaser.GameObjects.Components.AlphaSingle
6262
* @extends Phaser.GameObjects.Components.BlendMode
6363
* @extends Phaser.GameObjects.Components.ComputedSize
6464
* @extends Phaser.GameObjects.Components.Depth
@@ -76,7 +76,7 @@ var Container = new Class({
7676
Extends: GameObject,
7777

7878
Mixins: [
79-
Components.Alpha,
79+
Components.AlphaSingle,
8080
Components.BlendMode,
8181
Components.ComputedSize,
8282
Components.Depth,

src/gameobjects/container/ContainerWebGLRenderer.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,7 @@ var ContainerWebGLRenderer = function (renderer, container, interpolationPercent
5252
renderer.setBlendMode(0);
5353
}
5454

55-
var alphaTopLeft = container.alphaTopLeft;
56-
var alphaTopRight = container.alphaTopRight;
57-
var alphaBottomLeft = container.alphaBottomLeft;
58-
var alphaBottomRight = container.alphaBottomRight;
55+
var alpha = container.alpha;
5956

6057
var scrollFactorX = container.scrollFactorX;
6158
var scrollFactorY = container.scrollFactorY;
@@ -123,7 +120,7 @@ var ContainerWebGLRenderer = function (renderer, container, interpolationPercent
123120
// Set parent values
124121
child.setScrollFactor(childScrollFactorX * scrollFactorX, childScrollFactorY * scrollFactorY);
125122

126-
child.setAlpha(childAlphaTopLeft * alphaTopLeft, childAlphaTopRight * alphaTopRight, childAlphaBottomLeft * alphaBottomLeft, childAlphaBottomRight * alphaBottomRight);
123+
child.setAlpha(childAlphaTopLeft * alpha, childAlphaTopRight * alpha, childAlphaBottomLeft * alpha, childAlphaBottomRight * alpha);
127124

128125
// Render
129126
child.renderWebGL(renderer, child, interpolationPercentage, camera, transformMatrix);

0 commit comments

Comments
 (0)