Skip to content

Commit

Permalink
[NUI] Fix relative layout issue on DefaultLinearItem
Browse files Browse the repository at this point in the history
  • Loading branch information
everLEEst committed Oct 26, 2022
1 parent fde5d7e commit b7ff10d
Showing 1 changed file with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,10 @@ private View InternalIcon
itemIcon = CreateIcon(ItemStyle?.Icon);
if (itemIcon != null)
{
layoutChanged = true;
Add(itemIcon);
itemIcon.Relayout += OnIconRelayout;
layoutChanged = true;
LayoutChild();
}
}
return itemIcon;
Expand All @@ -108,6 +109,7 @@ private View InternalIcon
itemIcon.Relayout += OnIconRelayout;
}
layoutChanged = true;
LayoutChild();
}
}

Expand Down Expand Up @@ -147,15 +149,18 @@ public TextLabel Label
itemLabel = CreateLabel(ItemStyle?.Label);
if (itemLabel != null)
{
layoutChanged = true;
Add(itemLabel);
layoutChanged = true;
LayoutChild();
}
}
return itemLabel;
}
internal set
{
itemLabel = value;
layoutChanged = true;
LayoutChild();
}
}

Expand Down Expand Up @@ -200,15 +205,18 @@ public TextLabel SubLabel
itemSubLabel = CreateLabel(ItemStyle?.SubLabel);
if (itemLabel != null)
{
layoutChanged = true;
Add(itemSubLabel);
layoutChanged = true;
LayoutChild();
}
}
return itemSubLabel;
}
internal set
{
itemSubLabel = value;
layoutChanged = true;
LayoutChild();
}
}

Expand Down Expand Up @@ -265,9 +273,10 @@ private View InternalExtra
itemExtra = CreateIcon(ItemStyle?.Extra);
if (itemExtra != null)
{
layoutChanged = true;
Add(itemExtra);
itemExtra.Relayout += OnExtraRelayout;
layoutChanged = true;
LayoutChild();
}
}
return itemExtra;
Expand All @@ -283,6 +292,7 @@ private View InternalExtra
Add(itemExtra);
}
layoutChanged = true;
LayoutChild();
}
}

Expand Down Expand Up @@ -342,6 +352,8 @@ public override void ApplyStyle(ViewStyle viewStyle)
[EditorBrowsable(EditorBrowsableState.Never)]
public override void OnRelayout(Vector2 size, RelayoutContainer container)
{
LayoutChild();

base.OnRelayout(size, container);

if (prevSize != Size)
Expand Down

0 comments on commit b7ff10d

Please sign in to comment.