Skip to content

Commit ea76915

Browse files
committed
Use public property for blend mode check phaserjs#4771
1 parent a0292b5 commit ea76915

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

src/gameobjects/container/ContainerCanvasRenderer.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,26 +66,25 @@ var ContainerCanvasRenderer = function (renderer, container, interpolationPercen
6666
}
6767

6868
var childAlpha = child.alpha;
69-
var childBlendMode = child._blendMode;
7069
var childScrollFactorX = child.scrollFactorX;
7170
var childScrollFactorY = child.scrollFactorY;
7271

72+
if (!containerHasBlendMode && child.blendMode !== renderer.currentBlendMode)
73+
{
74+
// If Container doesn't have its own blend mode, then a child can have one
75+
renderer.setBlendMode(child.blendMode);
76+
}
77+
7378
// Set parent values
7479
child.setScrollFactor(childScrollFactorX * scrollFactorX, childScrollFactorY * scrollFactorY);
7580
child.setAlpha(childAlpha * alpha);
7681

77-
if (containerHasBlendMode)
78-
{
79-
child.setBlendMode(container._blendMode);
80-
}
81-
8282
// Render
8383
child.renderCanvas(renderer, child, interpolationPercentage, camera, transformMatrix);
8484

8585
// Restore original values
8686
child.setAlpha(childAlpha);
8787
child.setScrollFactor(childScrollFactorX, childScrollFactorY);
88-
child.setBlendMode(childBlendMode);
8988
}
9089
};
9190

0 commit comments

Comments
 (0)