Merge pull request #1590 from knoxHuang/master

Adjust the timing of CCMask creation for fireball/issues/5568
This commit is contained in:
Jare Guo
2017-04-17 14:09:51 +08:00
committed by GitHub
+11 -6
View File
@@ -242,13 +242,11 @@ var Mask = cc.Class({
}
},
onEnable: function () {
if (this.type === MaskType.IMAGE_STENCIL &&
cc._renderType !== cc.game.RENDER_TYPE_WEBGL && !CC_JSB) {
cc.warnID(4200);
return;
}
__preload: function () {
this._refreshStencil();
},
onEnable: function () {
this._super();
this.node.on('size-changed', this._refreshStencil, this);
this.node.on('anchor-changed', this._refreshStencil, this);
@@ -272,6 +270,13 @@ var Mask = cc.Class({
},
_refreshStencil: function () {
// Check whether the conditions are met
if (this.type === MaskType.IMAGE_STENCIL &&
cc._renderType !== cc.game.RENDER_TYPE_WEBGL && !CC_JSB) {
cc.warnID(4200);
return;
}
var contentSize = this.node.getContentSize();
var anchorPoint = this.node.getAnchorPoint();
var stencil = this._clippingStencil;