Support lazy loading image mask (#3123)

This commit is contained in:
pandamicro
2018-08-21 00:11:41 +08:00
committed by GitHub
parent a8a84dd9fa
commit 2edeb68f52
+11 -1
View File
@@ -257,7 +257,17 @@ let Mask = cc.Class({
onEnable () {
this._super();
if (this._type !== MaskType.IMAGE_STENCIL) {
if (this._type === MaskType.IMAGE_STENCIL) {
if (!this._spriteFrame || !this._spriteFrame.textureLoaded()) {
// Do not render when sprite frame is not ready
this.markForRender(false);
if (this._spriteFrame) {
this._spriteFrame.once('load', this._onTextureLoaded, this);
this._spriteFrame.ensureLoadTexture();
}
}
}
else {
this._updateGraphics();
}