Inline single-use constants

This commit is contained in:
Dean Herbert 2022-05-03 14:30:38 +09:00
parent 4a56297c1c
commit 8e0235392f

View File

@ -18,10 +18,8 @@ namespace osu.Game.Graphics.UserInterface
{ {
public class ShearedSearchTextBox : CompositeDrawable, IHasCurrentValue<string> public class ShearedSearchTextBox : CompositeDrawable, IHasCurrentValue<string>
{ {
private const float icon_container_width = 50;
private const float corner_radius = 7; private const float corner_radius = 7;
private const float height = 42;
private readonly Vector2 shear = new Vector2(ShearedOverlayContainer.SHEAR, 0);
private readonly Box background; private readonly Box background;
private readonly Box searchBoxBackground; private readonly Box searchBoxBackground;
private readonly SearchTextBox textBox; private readonly SearchTextBox textBox;
@ -44,8 +42,8 @@ namespace osu.Game.Graphics.UserInterface
public ShearedSearchTextBox() public ShearedSearchTextBox()
{ {
Height = height; Height = 42;
Shear = shear; Shear = new Vector2(ShearedOverlayContainer.SHEAR, 0);
Masking = true; Masking = true;
CornerRadius = corner_radius; CornerRadius = corner_radius;
InternalChild = new Container InternalChild = new Container
@ -78,13 +76,13 @@ namespace osu.Game.Graphics.UserInterface
}, },
textBox = new InnerSearchTextBox textBox = new InnerSearchTextBox
{ {
Shear = -shear, Shear = -new Vector2(ShearedOverlayContainer.SHEAR, 0),
Anchor = Anchor.CentreLeft, Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft, Origin = Anchor.CentreLeft,
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Padding = new MarginPadding Padding = new MarginPadding
{ {
Horizontal = corner_radius + shear.X Horizontal = corner_radius + new Vector2(ShearedOverlayContainer.SHEAR, 0).X
} }
} }
} }
@ -93,7 +91,7 @@ namespace osu.Game.Graphics.UserInterface
{ {
Name = @"Icon container", Name = @"Icon container",
RelativeSizeAxes = Axes.Y, RelativeSizeAxes = Axes.Y,
Width = icon_container_width, Width = 50,
Origin = Anchor.CentreRight, Origin = Anchor.CentreRight,
Anchor = Anchor.CentreRight, Anchor = Anchor.CentreRight,
Children = new Drawable[] Children = new Drawable[]
@ -104,13 +102,17 @@ namespace osu.Game.Graphics.UserInterface
Origin = Anchor.Centre, Origin = Anchor.Centre,
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Size = new Vector2(16), Size = new Vector2(16),
Shear = -shear Shear = -new Vector2(ShearedOverlayContainer.SHEAR, 0)
} }
} }
} }
} }
}, },
ColumnDimensions = new[] { new Dimension(), new Dimension(GridSizeMode.AutoSize) } ColumnDimensions = new[]
{
new Dimension(),
new Dimension(GridSizeMode.AutoSize)
}
} }
} }
}; };