mirror of
https://github.com/osukey/osukey.git
synced 2025-06-05 12:57:39 +09:00
Allow checkbox nub to be moved to the left
This commit is contained in:
parent
cb87da2bb8
commit
b2f1e133f8
@ -48,7 +48,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
private SampleChannel sampleChecked;
|
private SampleChannel sampleChecked;
|
||||||
private SampleChannel sampleUnchecked;
|
private SampleChannel sampleUnchecked;
|
||||||
|
|
||||||
public OsuCheckbox()
|
public OsuCheckbox(bool nubOnRight = true)
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Y;
|
AutoSizeAxes = Axes.Y;
|
||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
@ -61,17 +61,24 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
RelativeSizeAxes = Axes.X,
|
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()
|
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);
|
Nub.Current.BindTo(Current);
|
||||||
|
|
||||||
Current.DisabledChanged += disabled => labelText.Alpha = Nub.Alpha = disabled ? 0.3f : 1;
|
Current.DisabledChanged += disabled => labelText.Alpha = Nub.Alpha = disabled ? 0.3f : 1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user