Allow checkbox nub to be moved to the left

This commit is contained in:
Dean Herbert 2021-02-04 16:53:55 +09:00
parent cb87da2bb8
commit b2f1e133f8

View File

@ -48,7 +48,7 @@ namespace osu.Game.Graphics.UserInterface
private SampleChannel sampleChecked;
private SampleChannel sampleUnchecked;
public OsuCheckbox()
public OsuCheckbox(bool nubOnRight = true)
{
AutoSizeAxes = Axes.Y;
RelativeSizeAxes = Axes.X;
@ -61,17 +61,24 @@ namespace osu.Game.Graphics.UserInterface
{
AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X,
Padding = new MarginPadding { Right = Nub.EXPANDED_SIZE + nub_padding }
},
Nub = new Nub
{
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
Margin = new MarginPadding { Right = nub_padding },
},
Nub = new Nub(),
new HoverClickSounds()
};
if (nubOnRight)
{
Nub.Anchor = Anchor.CentreRight;
Nub.Origin = Anchor.CentreRight;
Nub.Margin = new MarginPadding { Right = nub_padding };
labelText.Padding = new MarginPadding { Right = Nub.EXPANDED_SIZE + nub_padding };
}
else
{
Nub.Margin = new MarginPadding { Left = nub_padding };
labelText.Padding = new MarginPadding { Left = Nub.EXPANDED_SIZE + nub_padding };
}
Nub.Current.BindTo(Current);
Current.DisabledChanged += disabled => labelText.Alpha = Nub.Alpha = disabled ? 0.3f : 1;