From 1934459b9bf3320e8dc5bfb460d48e0d4e04777c Mon Sep 17 00:00:00 2001 From: qiuguohua Date: Thu, 9 Feb 2023 16:07:31 +0800 Subject: [PATCH] Add a check that windowId is 0 by default (#14159) --- cocos/ui/view.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cocos/ui/view.ts b/cocos/ui/view.ts index 7fad69d9c1..4e7e560f8c 100644 --- a/cocos/ui/view.ts +++ b/cocos/ui/view.ts @@ -588,7 +588,8 @@ export class View extends Eventify(System) { } private _updateAdaptResult (width: number, height: number, windowId?: number) { - cclegacy.director.root.resize(width, height, windowId === undefined ? 1 : windowId); + // The default invalid windowId is 0 + cclegacy.director.root.resize(width, height, (windowId === undefined || windowId === 0) ? 1 : windowId); // Frame size changed, do resize works const w = this._designResolutionSize.width; const h = this._designResolutionSize.height;