Extract constants properly

This commit is contained in:
Bartłomiej Dach 2023-09-11 08:29:37 +02:00
parent 23c4a03848
commit c1a2b86f3f
No known key found for this signature in database
2 changed files with 13 additions and 14 deletions

View File

@ -17,6 +17,10 @@ namespace osu.Game.Graphics.UserInterface
{
public partial class ShearedButton : OsuClickableContainer
{
public const float HEIGHT = 50;
public const float CORNER_RADIUS = 7;
public const float BORDER_THICKNESS = 2;
public LocalisableString Text
{
get => text.Text;
@ -83,12 +87,10 @@ namespace osu.Game.Graphics.UserInterface
/// </param>
public ShearedButton(float? width = null)
{
Height = 50;
Height = HEIGHT;
Padding = new MarginPadding { Horizontal = shear * 50 };
const float corner_radius = 7;
Content.CornerRadius = corner_radius;
Content.CornerRadius = CORNER_RADIUS;
Content.Shear = new Vector2(shear, 0);
Content.Masking = true;
Content.Anchor = Content.Origin = Anchor.Centre;
@ -98,9 +100,9 @@ namespace osu.Game.Graphics.UserInterface
backgroundLayer = new Container
{
RelativeSizeAxes = Axes.Y,
CornerRadius = corner_radius,
CornerRadius = CORNER_RADIUS,
Masking = true,
BorderThickness = 2,
BorderThickness = BORDER_THICKNESS,
Children = new Drawable[]
{
background = new Box

View File

@ -39,7 +39,6 @@ namespace osu.Game.Overlays.Mods
private VerticalAttributeDisplay approachRateDisplay = null!;
private VerticalAttributeDisplay overallDifficultyDisplay = null!;
public const float HEIGHT = 50; // as ModSelectOverlay footer buttons
private const float transition_duration = 250;
private IBeatmapInfo? beatmapInfo;
@ -74,8 +73,6 @@ namespace osu.Game.Overlays.Mods
{
// values as ModSelectOverlay footer buttons
const float shear = ShearedOverlayContainer.SHEAR;
const float corner_radius = 7;
const float border_thickness = 2;
AutoSizeAxes = Axes.Both;
InternalChild = content = new InputBlockingContainer
@ -83,10 +80,10 @@ namespace osu.Game.Overlays.Mods
Origin = Anchor.BottomRight,
Anchor = Anchor.BottomRight,
AutoSizeAxes = Axes.X,
Height = HEIGHT,
Height = ShearedButton.HEIGHT,
Shear = new Vector2(shear, 0),
CornerRadius = corner_radius,
BorderThickness = border_thickness,
CornerRadius = ShearedButton.CORNER_RADIUS,
BorderThickness = ShearedButton.BORDER_THICKNESS,
Masking = true,
Children = new Drawable[]
{
@ -107,8 +104,8 @@ namespace osu.Game.Overlays.Mods
{
AutoSizeAxes = Axes.X,
RelativeSizeAxes = Axes.Y,
BorderThickness = border_thickness,
CornerRadius = corner_radius,
BorderThickness = ShearedButton.BORDER_THICKNESS,
CornerRadius = ShearedButton.CORNER_RADIUS,
Masking = true,
Children = new Drawable[]
{