Fixed mask bug
Mask was not getting transformed applied
This commit is contained in:
parent
1062c4e1d3
commit
72ba698851
6 changed files with 17 additions and 15 deletions
|
@ -1002,8 +1002,9 @@ Object.defineProperty(PIXI.DisplayObject.prototype, 'mask', {
|
||||||
},
|
},
|
||||||
set: function(value) {
|
set: function(value) {
|
||||||
|
|
||||||
|
if(this._mask)this._mask.isMask = false;
|
||||||
this._mask = value;
|
this._mask = value;
|
||||||
|
this._mask.isMask = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -5330,7 +5331,7 @@ PIXI.WebGLMaskManager.prototype.pushMask = function(maskData, renderSession)
|
||||||
gl.stencilFunc(gl.ALWAYS,1,1);
|
gl.stencilFunc(gl.ALWAYS,1,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
maskData.visible = false;
|
// maskData.visible = false;
|
||||||
|
|
||||||
this.maskStack.push(maskData);
|
this.maskStack.push(maskData);
|
||||||
|
|
||||||
|
@ -6360,8 +6361,8 @@ PIXI.CanvasMaskManager.prototype.pushMask = function(maskData, context)
|
||||||
{
|
{
|
||||||
context.save();
|
context.save();
|
||||||
|
|
||||||
maskData.visible = false;
|
//maskData.visible = false;
|
||||||
maskData.alpha = 0;
|
// maskData.alpha = 0;
|
||||||
|
|
||||||
var cacheAlpha = maskData.alpha;
|
var cacheAlpha = maskData.alpha;
|
||||||
var transform = maskData.worldTransform;
|
var transform = maskData.worldTransform;
|
||||||
|
@ -7347,7 +7348,7 @@ PIXI.Graphics.prototype.clear = function()
|
||||||
PIXI.Graphics.prototype._renderWebGL = function(renderSession)
|
PIXI.Graphics.prototype._renderWebGL = function(renderSession)
|
||||||
{
|
{
|
||||||
// if the sprite is not visible or the alpha is 0 then no need to render this element
|
// if the sprite is not visible or the alpha is 0 then no need to render this element
|
||||||
if(this.visible === false || this.alpha === 0)return;
|
if(this.visible === false || this.alpha === 0 || this.isMask === true)return;
|
||||||
|
|
||||||
renderSession.spriteBatch.stop();
|
renderSession.spriteBatch.stop();
|
||||||
|
|
||||||
|
@ -7367,7 +7368,7 @@ PIXI.Graphics.prototype._renderWebGL = function(renderSession)
|
||||||
PIXI.Graphics.prototype._renderCanvas = function(renderSession)
|
PIXI.Graphics.prototype._renderCanvas = function(renderSession)
|
||||||
{
|
{
|
||||||
// if the sprite is not visible or the alpha is 0 then no need to render this element
|
// if the sprite is not visible or the alpha is 0 then no need to render this element
|
||||||
if(this.visible === false || this.alpha === 0)return;
|
if(this.visible === false || this.alpha === 0 || this.isMask === true)return;
|
||||||
|
|
||||||
var context = renderSession.context;
|
var context = renderSession.context;
|
||||||
var transform = this.worldTransform;
|
var transform = this.worldTransform;
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -305,8 +305,9 @@ Object.defineProperty(PIXI.DisplayObject.prototype, 'mask', {
|
||||||
},
|
},
|
||||||
set: function(value) {
|
set: function(value) {
|
||||||
|
|
||||||
|
if(this._mask)this._mask.isMask = false;
|
||||||
this._mask = value;
|
this._mask = value;
|
||||||
|
this._mask.isMask = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -236,7 +236,7 @@ PIXI.Graphics.prototype.clear = function()
|
||||||
PIXI.Graphics.prototype._renderWebGL = function(renderSession)
|
PIXI.Graphics.prototype._renderWebGL = function(renderSession)
|
||||||
{
|
{
|
||||||
// if the sprite is not visible or the alpha is 0 then no need to render this element
|
// if the sprite is not visible or the alpha is 0 then no need to render this element
|
||||||
if(this.visible === false || this.alpha === 0)return;
|
if(this.visible === false || this.alpha === 0 || this.isMask === true)return;
|
||||||
|
|
||||||
renderSession.spriteBatch.stop();
|
renderSession.spriteBatch.stop();
|
||||||
|
|
||||||
|
@ -256,7 +256,7 @@ PIXI.Graphics.prototype._renderWebGL = function(renderSession)
|
||||||
PIXI.Graphics.prototype._renderCanvas = function(renderSession)
|
PIXI.Graphics.prototype._renderCanvas = function(renderSession)
|
||||||
{
|
{
|
||||||
// if the sprite is not visible or the alpha is 0 then no need to render this element
|
// if the sprite is not visible or the alpha is 0 then no need to render this element
|
||||||
if(this.visible === false || this.alpha === 0)return;
|
if(this.visible === false || this.alpha === 0 || this.isMask === true)return;
|
||||||
|
|
||||||
var context = renderSession.context;
|
var context = renderSession.context;
|
||||||
var transform = this.worldTransform;
|
var transform = this.worldTransform;
|
||||||
|
|
|
@ -13,8 +13,8 @@ PIXI.CanvasMaskManager.prototype.pushMask = function(maskData, context)
|
||||||
{
|
{
|
||||||
context.save();
|
context.save();
|
||||||
|
|
||||||
maskData.visible = false;
|
//maskData.visible = false;
|
||||||
maskData.alpha = 0;
|
// maskData.alpha = 0;
|
||||||
|
|
||||||
var cacheAlpha = maskData.alpha;
|
var cacheAlpha = maskData.alpha;
|
||||||
var transform = maskData.worldTransform;
|
var transform = maskData.worldTransform;
|
||||||
|
|
|
@ -19,7 +19,7 @@ PIXI.WebGLMaskManager.prototype.pushMask = function(maskData, renderSession)
|
||||||
gl.stencilFunc(gl.ALWAYS,1,1);
|
gl.stencilFunc(gl.ALWAYS,1,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
maskData.visible = false;
|
// maskData.visible = false;
|
||||||
|
|
||||||
this.maskStack.push(maskData);
|
this.maskStack.push(maskData);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue