From 683b8919f0ed1ade4a0117f6f91abb8009e2f78e Mon Sep 17 00:00:00 2001 From: JoneLau <32630749+JoneLau@users.noreply.github.com> Date: Mon, 8 Jul 2019 14:02:26 +0800 Subject: [PATCH] fix webgl warning when label width is zero (#4829) --- cocos/3d/ui/components/label-component.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/cocos/3d/ui/components/label-component.ts b/cocos/3d/ui/components/label-component.ts index cc7309766f..41ae3af6bb 100644 --- a/cocos/3d/ui/components/label-component.ts +++ b/cocos/3d/ui/components/label-component.ts @@ -384,9 +384,7 @@ export class LabelComponent extends UIRenderComponent { this._renderData = null; } // this._fontAtlas = null; - this._flushAssembler(); - this._applyFontTexture(true); - this.updateRenderData(); + this.updateRenderData(true); } /** @@ -679,7 +677,7 @@ export class LabelComponent extends UIRenderComponent { } protected _canRender () { - if (!super._canRender()){ + if (!super._canRender() || !this.node.width || !this.node.height){ return false; } @@ -770,7 +768,7 @@ export class LabelComponent extends UIRenderComponent { this._flushMaterial(); } - if (force && this._assembler && this._assembler.updateRenderData) { + if (force && this._assembler && this._canRender() && this._assembler.updateRenderData ) { this._assembler.updateRenderData(this); } }