Reduce container nesting by one level

This commit is contained in:
Dean Herbert
2022-05-03 14:34:18 +09:00
parent 8e0235392f
commit bc88c4ee8e

View File

@ -46,73 +46,70 @@ namespace osu.Game.Graphics.UserInterface
Shear = new Vector2(ShearedOverlayContainer.SHEAR, 0); Shear = new Vector2(ShearedOverlayContainer.SHEAR, 0);
Masking = true; Masking = true;
CornerRadius = corner_radius; CornerRadius = corner_radius;
InternalChild = new Container
InternalChildren = new Drawable[]
{ {
RelativeSizeAxes = Axes.Both, background = new Box
Children = new Drawable[]
{ {
background = new Box RelativeSizeAxes = Axes.Both
},
new GridContainer
{
RelativeSizeAxes = Axes.Both,
Content = new[]
{ {
RelativeSizeAxes = Axes.Both new Drawable[]
},
new GridContainer
{
RelativeSizeAxes = Axes.Both,
Content = new[]
{ {
new Drawable[] new Container
{ {
new Container Name = @"Search box container",
RelativeSizeAxes = Axes.Both,
CornerRadius = corner_radius,
Masking = true,
Children = new Drawable[]
{ {
Name = @"Search box container", searchBoxBackground = new Box
RelativeSizeAxes = Axes.Both,
CornerRadius = corner_radius,
Masking = true,
Children = new Drawable[]
{ {
searchBoxBackground = new Box RelativeSizeAxes = Axes.Both
{ },
RelativeSizeAxes = Axes.Both textBox = new InnerSearchTextBox
},
textBox = new InnerSearchTextBox
{
Shear = -new Vector2(ShearedOverlayContainer.SHEAR, 0),
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
RelativeSizeAxes = Axes.X,
Padding = new MarginPadding
{
Horizontal = corner_radius + new Vector2(ShearedOverlayContainer.SHEAR, 0).X
}
}
}
},
new Container
{
Name = @"Icon container",
RelativeSizeAxes = Axes.Y,
Width = 50,
Origin = Anchor.CentreRight,
Anchor = Anchor.CentreRight,
Children = new Drawable[]
{ {
new SpriteIcon Shear = -Shear,
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
RelativeSizeAxes = Axes.X,
Padding = new MarginPadding
{ {
Icon = FontAwesome.Solid.Search, Horizontal = corner_radius + Shear.X
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
Size = new Vector2(16),
Shear = -new Vector2(ShearedOverlayContainer.SHEAR, 0)
} }
} }
} }
},
new Container
{
Name = @"Icon container",
RelativeSizeAxes = Axes.Y,
Width = 50,
Origin = Anchor.CentreRight,
Anchor = Anchor.CentreRight,
Children = new Drawable[]
{
new SpriteIcon
{
Icon = FontAwesome.Solid.Search,
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
Size = new Vector2(16),
Shear = -Shear
}
}
} }
},
ColumnDimensions = new[]
{
new Dimension(),
new Dimension(GridSizeMode.AutoSize)
} }
},
ColumnDimensions = new[]
{
new Dimension(),
new Dimension(GridSizeMode.AutoSize)
} }
} }
}; };