Skip to content

Commit 68818ea

Browse files
orchid-worldstar-e
authored andcommitted
fix(ui): ensure Layout recalculates layout when a child node’s scale changes
1 parent dbd3c43 commit 68818ea

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

cocos/ui/layout.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1144,11 +1144,10 @@ export class Layout extends Component {
11441144
}
11451145

11461146
protected _transformDirty (type: TransformBit): void {
1147-
if (!(type & TransformBit.SCALE) || !(type & TransformBit.POSITION) || !this._affectedByScale) {
1148-
return;
1147+
// Invalidate layout when scale is affected and changed, or position is changed.
1148+
if ((type & TransformBit.SCALE && this._affectedByScale) || (type & TransformBit.POSITION)) {
1149+
this._doLayoutDirty();
11491150
}
1150-
1151-
this._doLayoutDirty();
11521151
}
11531152

11541153
protected _doLayoutDirty (): void {

0 commit comments

Comments
 (0)