Skip to content

Commit

Permalink
Canvas listens to design resolution changes (#17633)
Browse files Browse the repository at this point in the history
Co-authored-by: qgh <>
  • Loading branch information
qiuguohua committed Sep 13, 2024
1 parent c679595 commit 3e78462
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cocos/2d/framework/canvas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ export class Canvas extends RenderRoot2D {
} else {
// In Editor dont need resized camera when scene window resize
view.on('canvas-resize', this._thisOnCameraResized, this);
view.on('design-resolution-changed', this._thisOnCameraResized, this);
}
}

Expand All @@ -216,6 +217,7 @@ export class Canvas extends RenderRoot2D {
public onDestroy (): void {
super.onDestroy();
view.off('canvas-resize', this._thisOnCameraResized, this);
view.off('design-resolution-changed', this._thisOnCameraResized, this);
}

protected _onResizeCamera (): void {
Expand Down

0 comments on commit 3e78462

Please sign in to comment.