mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-01 15:52:40 +08:00
Support lazy loading image mask (#3123)
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user