mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-04 02:02:41 +08:00
Merge pull request #1590 from knoxHuang/master
Adjust the timing of CCMask creation for fireball/issues/5568
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user