mirror of
https://github.com/photonstorm/phaser
synced 2024-11-28 07:31:11 +00:00
Merge pull request #5193 from scott20145/master
Fix nested mask behaviour for Phaser.CANVAS mode
This commit is contained in:
commit
259b702df8
2 changed files with 18 additions and 1 deletions
|
@ -56,6 +56,10 @@ var ContainerCanvasRenderer = function (renderer, container, interpolationPercen
|
|||
var scrollFactorX = container.scrollFactorX;
|
||||
var scrollFactorY = container.scrollFactorY;
|
||||
|
||||
if (container.mask) {
|
||||
container.mask.preRenderCanvas(renderer, null, camera);
|
||||
}
|
||||
|
||||
for (var i = 0; i < children.length; i++)
|
||||
{
|
||||
var child = children[i];
|
||||
|
@ -86,6 +90,11 @@ var ContainerCanvasRenderer = function (renderer, container, interpolationPercen
|
|||
child.setAlpha(childAlpha);
|
||||
child.setScrollFactor(childScrollFactorX, childScrollFactorY);
|
||||
}
|
||||
|
||||
if (container.mask) {
|
||||
container.mask.postRenderCanvas(renderer);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
module.exports = ContainerCanvasRenderer;
|
||||
|
|
|
@ -767,8 +767,16 @@ var CanvasRenderer = new Class({
|
|||
|
||||
ctx.imageSmoothingEnabled = !(!this.antialias || frame.source.scaleMode);
|
||||
|
||||
if (sprite.mask) {
|
||||
sprite.mask.preRenderCanvas(this, sprite, camera);
|
||||
}
|
||||
|
||||
ctx.drawImage(frame.source.image, frameX, frameY, frameWidth, frameHeight, x, y, frameWidth / res, frameHeight / res);
|
||||
|
||||
if (sprite.mask) {
|
||||
sprite.mask.postRenderCanvas(this, sprite, camera);
|
||||
}
|
||||
|
||||
ctx.restore();
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in a new issue