From 100bccaf9e4cb0c692e2812e18b968214dcf719a Mon Sep 17 00:00:00 2001 From: orchid-world Date: Tue, 3 Feb 2026 10:15:23 +0800 Subject: [PATCH] =?UTF-8?q?fix(ui):=20ensure=20Layout=20recalculates=20lay?= =?UTF-8?q?out=20when=20a=20child=20node=E2=80=99s=20scale=20changes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cocos/ui/layout.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/cocos/ui/layout.ts b/cocos/ui/layout.ts index 57e6c98669..ac64334a89 100644 --- a/cocos/ui/layout.ts +++ b/cocos/ui/layout.ts @@ -1144,11 +1144,10 @@ export class Layout extends Component { } protected _transformDirty (type: TransformBit): void { - if (!(type & TransformBit.SCALE) || !(type & TransformBit.POSITION) || !this._affectedByScale) { - return; + // Invalidate layout when scale is affected and changed, or position is changed. + if ((type & TransformBit.SCALE && this._affectedByScale) || (type & TransformBit.POSITION)) { + this._doLayoutDirty(); } - - this._doLayoutDirty(); } protected _doLayoutDirty (): void {