diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneShearedButtons.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneShearedButtons.cs
index 118d32ee70..8db22f2d65 100644
--- a/osu.Game.Tests/Visual/UserInterface/TestSceneShearedButtons.cs
+++ b/osu.Game.Tests/Visual/UserInterface/TestSceneShearedButtons.cs
@@ -7,11 +7,13 @@ using System.Linq;
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
+using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Testing;
using osu.Framework.Utils;
using osu.Game.Graphics.UserInterface;
using osu.Game.Overlays;
+using osuTK;
using osuTK.Input;
namespace osu.Game.Tests.Visual.UserInterface
@@ -35,7 +37,7 @@ namespace osu.Game.Tests.Visual.UserInterface
if (bigButton)
{
- Child = button = new ShearedButton(400)
+ Child = button = new ShearedButton(400, 80)
{
LighterColour = Colour4.FromHex("#FFFFFF"),
DarkerColour = Colour4.FromHex("#FFCC22"),
@@ -44,13 +46,12 @@ namespace osu.Game.Tests.Visual.UserInterface
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Text = "Let's GO!",
- Height = 80,
Action = () => actionFired = true,
};
}
else
{
- Child = button = new ShearedButton(200)
+ Child = button = new ShearedButton(200, 80)
{
LighterColour = Colour4.FromHex("#FF86DD"),
DarkerColour = Colour4.FromHex("#DE31AE"),
@@ -58,7 +59,6 @@ namespace osu.Game.Tests.Visual.UserInterface
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Text = "Press me",
- Height = 80,
Action = () => actionFired = true,
};
}
@@ -171,5 +171,48 @@ namespace osu.Game.Tests.Visual.UserInterface
void setToggleDisabledState(bool disabled) => AddStep($"{(disabled ? "disable" : "enable")} toggle", () => button.Active.Disabled = disabled);
}
+
+ [Test]
+ public void TestButtons()
+ {
+ AddStep("create buttons", () => Children = new[]
+ {
+ new FillFlowContainer
+ {
+ Anchor = Anchor.Centre,
+ Origin = Anchor.Centre,
+ Direction = FillDirection.Horizontal,
+ AutoSizeAxes = Axes.Both,
+ Scale = new Vector2(2.5f),
+ Children = new Drawable[]
+ {
+ new ShearedButton(120)
+ {
+ Anchor = Anchor.BottomLeft,
+ Origin = Anchor.BottomLeft,
+ Text = "Test",
+ Action = () => { },
+ Padding = new MarginPadding(),
+ },
+ new ShearedButton(120, 40)
+ {
+ Anchor = Anchor.BottomLeft,
+ Origin = Anchor.BottomLeft,
+ Text = "Test",
+ Action = () => { },
+ Padding = new MarginPadding { Left = -1f },
+ },
+ new ShearedButton(120, 70)
+ {
+ Anchor = Anchor.BottomLeft,
+ Origin = Anchor.BottomLeft,
+ Text = "Test",
+ Action = () => { },
+ Padding = new MarginPadding { Left = 3f },
+ },
+ }
+ }
+ });
+ }
}
}
diff --git a/osu.Game/Graphics/UserInterface/ShearedButton.cs b/osu.Game/Graphics/UserInterface/ShearedButton.cs
index b1e7066a01..caf1f76d88 100644
--- a/osu.Game/Graphics/UserInterface/ShearedButton.cs
+++ b/osu.Game/Graphics/UserInterface/ShearedButton.cs
@@ -17,7 +17,7 @@ namespace osu.Game.Graphics.UserInterface
{
public partial class ShearedButton : OsuClickableContainer
{
- public const float HEIGHT = 50;
+ public const float DEFAULT_HEIGHT = 50;
public const float CORNER_RADIUS = 7;
public const float BORDER_THICKNESS = 2;
@@ -85,10 +85,11 @@ namespace osu.Game.Graphics.UserInterface
/// - If a value is provided (or the argument is omitted entirely), the button will autosize in width to fit the text.
///
///
- public ShearedButton(float? width = null)
+ /// The height of the button.
+ public ShearedButton(float? width = null, float height = DEFAULT_HEIGHT)
{
- Height = HEIGHT;
- Padding = new MarginPadding { Horizontal = shear * 50 };
+ Height = height;
+ Padding = new MarginPadding { Horizontal = shear * height };
Content.CornerRadius = CORNER_RADIUS;
Content.Shear = new Vector2(shear, 0);
diff --git a/osu.Game/Overlays/Mods/ModFooterInformationDisplay.cs b/osu.Game/Overlays/Mods/ModFooterInformationDisplay.cs
index 7fccf0cc13..8668879850 100644
--- a/osu.Game/Overlays/Mods/ModFooterInformationDisplay.cs
+++ b/osu.Game/Overlays/Mods/ModFooterInformationDisplay.cs
@@ -36,7 +36,7 @@ namespace osu.Game.Overlays.Mods
Origin = Anchor.BottomRight,
Anchor = Anchor.BottomRight,
AutoSizeAxes = Axes.X,
- Height = ShearedButton.HEIGHT,
+ Height = ShearedButton.DEFAULT_HEIGHT,
Shear = new Vector2(ShearedOverlayContainer.SHEAR, 0),
CornerRadius = ShearedButton.CORNER_RADIUS,
BorderThickness = ShearedButton.BORDER_THICKNESS,