Skip to content

Commit

Permalink
restore
Browse files Browse the repository at this point in the history
  • Loading branch information
GengineJS committed Dec 18, 2024
1 parent 1d4e979 commit 45fcb9f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cocos/2d/framework/ui-renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,10 @@ export class UIRenderer extends Renderer {
this.node.on(NodeEventType.ANCHOR_CHANGED, this._nodeStateChange, this);
this.node.on(NodeEventType.SIZE_CHANGED, this._nodeStateChange, this);
this.node.on(NodeEventType.PARENT_CHANGED, this._colorDirty, this);
// If the renderData is invalid, it needs to be rebuilt to recalculate the batch processing.
if (!this._renderData && this._flushAssembler) {
this._flushAssembler();
}
this.updateMaterial();
this._colorDirty();
uiRendererManager.addRenderer(this);
Expand All @@ -337,6 +341,9 @@ export class UIRenderer extends Renderer {
this.node.off(NodeEventType.ANCHOR_CHANGED, this._nodeStateChange, this);
this.node.off(NodeEventType.SIZE_CHANGED, this._nodeStateChange, this);
this.node.off(NodeEventType.PARENT_CHANGED, this._colorDirty, this);
// When disabling, it is necessary to free up idle space to fully utilize chunks
// and avoid breaking batch processing.
this.destroyRenderData();
uiRendererManager.removeRenderer(this);
this._renderFlag = false;
this._renderEntity.enabled = false;
Expand Down

0 comments on commit 45fcb9f

Please sign in to comment.