From c1a2b86f3f95142b5f0c73b2d2ae5acbd4006aa7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Mon, 11 Sep 2023 08:29:37 +0200 Subject: [PATCH] Extract constants properly --- osu.Game/Graphics/UserInterface/ShearedButton.cs | 14 ++++++++------ osu.Game/Overlays/Mods/ModEffectPreviewPanel.cs | 13 +++++-------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/ShearedButton.cs b/osu.Game/Graphics/UserInterface/ShearedButton.cs index f1afacb2f4..b1e7066a01 100644 --- a/osu.Game/Graphics/UserInterface/ShearedButton.cs +++ b/osu.Game/Graphics/UserInterface/ShearedButton.cs @@ -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 /// 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 diff --git a/osu.Game/Overlays/Mods/ModEffectPreviewPanel.cs b/osu.Game/Overlays/Mods/ModEffectPreviewPanel.cs index 79172a595c..aa7ddc47bc 100644 --- a/osu.Game/Overlays/Mods/ModEffectPreviewPanel.cs +++ b/osu.Game/Overlays/Mods/ModEffectPreviewPanel.cs @@ -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[] {