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 #4916

This commit is contained in:
Richard Davey 2019-12-28 17:27:31 +00:00
parent 949d882788
commit f0e7a9bcf9
2 changed files with 4 additions and 7 deletions

View file

@ -58,7 +58,7 @@ var Vector2 = require('../../math/Vector2');
* @constructor
* @since 3.4.0
*
* @extends Phaser.GameObjects.Components.Alpha
* @extends Phaser.GameObjects.Components.AlphaSingle
* @extends Phaser.GameObjects.Components.BlendMode
* @extends Phaser.GameObjects.Components.ComputedSize
* @extends Phaser.GameObjects.Components.Depth
@ -76,7 +76,7 @@ var Container = new Class({
Extends: GameObject,
Mixins: [
Components.Alpha,
Components.AlphaSingle,
Components.BlendMode,
Components.ComputedSize,
Components.Depth,

View file

@ -52,10 +52,7 @@ var ContainerWebGLRenderer = function (renderer, container, interpolationPercent
renderer.setBlendMode(0);
}
var alphaTopLeft = container.alphaTopLeft;
var alphaTopRight = container.alphaTopRight;
var alphaBottomLeft = container.alphaBottomLeft;
var alphaBottomRight = container.alphaBottomRight;
var alpha = container.alpha;
var scrollFactorX = container.scrollFactorX;
var scrollFactorY = container.scrollFactorY;
@ -123,7 +120,7 @@ var ContainerWebGLRenderer = function (renderer, container, interpolationPercent
// Set parent values
child.setScrollFactor(childScrollFactorX * scrollFactorX, childScrollFactorY * scrollFactorY);
child.setAlpha(childAlphaTopLeft * alphaTopLeft, childAlphaTopRight * alphaTopRight, childAlphaBottomLeft * alphaBottomLeft, childAlphaBottomRight * alphaBottomRight);
child.setAlpha(childAlphaTopLeft * alpha, childAlphaTopRight * alpha, childAlphaBottomLeft * alpha, childAlphaBottomRight * alpha);
// Render
child.renderWebGL(renderer, child, interpolationPercentage, camera, transformMatrix);