mirror of
https://github.com/photonstorm/phaser
synced 2024-11-24 05:33:35 +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
|
@ -55,7 +55,11 @@ var ContainerCanvasRenderer = function (renderer, container, interpolationPercen
|
|||
var alpha = container._alpha;
|
||||
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;
|
||||
|
|
|
@ -766,9 +766,17 @@ var CanvasRenderer = new Class({
|
|||
ctx.globalAlpha = alpha;
|
||||
|
||||
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