Fix IconButtons not being scaled correctly

This commit is contained in:
Dean Herbert
2019-06-14 13:40:32 +09:00
parent 73a83e7f05
commit 15b9b53d35
6 changed files with 23 additions and 32 deletions

View File

@ -11,7 +11,7 @@ namespace osu.Game.Graphics.UserInterface
{
public class IconButton : OsuAnimatedButton
{
public const float BUTTON_SIZE = 30;
public const float DEFAULT_BUTTON_SIZE = 30;
private Color4? iconColour;
@ -57,26 +57,11 @@ namespace osu.Game.Graphics.UserInterface
set => icon.Scale = value;
}
/// <summary>
/// The size of the <see cref="IconButton"/> while it is not being pressed.
/// </summary>
public Vector2 ButtonSize
{
get => Content.Size;
set
{
Content.RelativeSizeAxes = Axes.None;
Content.AutoSizeAxes = Axes.None;
Content.Size = value;
}
}
private readonly SpriteIcon icon;
public IconButton()
{
AutoSizeAxes = Axes.Both;
ButtonSize = new Vector2(BUTTON_SIZE);
Size = new Vector2(DEFAULT_BUTTON_SIZE);
Add(icon = new SpriteIcon
{