Skip to content

Commit 989e82f

Browse files
authored
Merge pull request fairygui#213 from H0nok4/pr/GComponentUpdateBoundIssues
fix:当子物体修改了锚点时,父物体计算Bound时添加对锚点的偏移
2 parents 6ebba0e + 53ce2ae commit 989e82f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Assets/Scripts/UI/GComponent.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1172,10 +1172,10 @@ virtual protected void UpdateBounds()
11721172
tmp = child.y;
11731173
if (tmp < ay)
11741174
ay = tmp;
1175-
tmp = child.x + child.actualWidth;
1175+
tmp = child.x + (child.pivotAsAnchor ? child.actualWidth * (1 - child.pivot.x) : child.actualWidth);//Add anchor offset
11761176
if (tmp > ar)
11771177
ar = tmp;
1178-
tmp = child.y + child.actualHeight;
1178+
tmp = child.y + (child.pivotAsAnchor ? child.actualHeight * (1 - child.pivot.y) : child.actualHeight);//Add anchor offset
11791179
if (tmp > ab)
11801180
ab = tmp;
11811181
}

0 commit comments

Comments
 (0)