mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 00:40:09 +09:00
correct label positioning
This commit is contained in:
@ -26,24 +26,24 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
{
|
{
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (labelText != null)
|
if (LabelTextFlowContainer != null)
|
||||||
labelText.Text = value;
|
LabelTextFlowContainer.Text = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public MarginPadding LabelPadding
|
public MarginPadding LabelPadding
|
||||||
{
|
{
|
||||||
get => labelText?.Padding ?? new MarginPadding();
|
get => LabelTextFlowContainer?.Padding ?? new MarginPadding();
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (labelText != null)
|
if (LabelTextFlowContainer != null)
|
||||||
labelText.Padding = value;
|
LabelTextFlowContainer.Padding = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected readonly Nub Nub;
|
protected readonly Nub Nub;
|
||||||
|
|
||||||
private readonly OsuTextFlowContainer labelText;
|
protected readonly OsuTextFlowContainer LabelTextFlowContainer;
|
||||||
private Sample sampleChecked;
|
private Sample sampleChecked;
|
||||||
private Sample sampleUnchecked;
|
private Sample sampleUnchecked;
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
labelText = new OsuTextFlowContainer(ApplyLabelParameters)
|
LabelTextFlowContainer = new OsuTextFlowContainer(ApplyLabelParameters)
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
@ -70,19 +70,19 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
Nub.Anchor = Anchor.CentreRight;
|
Nub.Anchor = Anchor.CentreRight;
|
||||||
Nub.Origin = Anchor.CentreRight;
|
Nub.Origin = Anchor.CentreRight;
|
||||||
Nub.Margin = new MarginPadding { Right = nub_padding };
|
Nub.Margin = new MarginPadding { Right = nub_padding };
|
||||||
labelText.Padding = new MarginPadding { Right = Nub.EXPANDED_SIZE + nub_padding * 2 };
|
LabelTextFlowContainer.Padding = new MarginPadding { Right = Nub.EXPANDED_SIZE + nub_padding * 2 };
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Nub.Anchor = Anchor.CentreLeft;
|
Nub.Anchor = Anchor.CentreLeft;
|
||||||
Nub.Origin = Anchor.CentreLeft;
|
Nub.Origin = Anchor.CentreLeft;
|
||||||
Nub.Margin = new MarginPadding { Left = nub_padding };
|
Nub.Margin = new MarginPadding { Left = nub_padding };
|
||||||
labelText.Padding = new MarginPadding { Left = Nub.EXPANDED_SIZE + nub_padding * 2 };
|
LabelTextFlowContainer.Padding = new MarginPadding { Left = Nub.EXPANDED_SIZE + nub_padding * 2 };
|
||||||
}
|
}
|
||||||
|
|
||||||
Nub.Current.BindTo(Current);
|
Nub.Current.BindTo(Current);
|
||||||
|
|
||||||
Current.DisabledChanged += disabled => labelText.Alpha = Nub.Alpha = disabled ? 0.3f : 1;
|
Current.DisabledChanged += disabled => LabelTextFlowContainer.Alpha = Nub.Alpha = disabled ? 0.3f : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -19,6 +19,8 @@ namespace osu.Game.Graphics.UserInterfaceV2
|
|||||||
Size = new Vector2(100, 50);
|
Size = new Vector2(100, 50);
|
||||||
Anchor = Anchor.CentreLeft;
|
Anchor = Anchor.CentreLeft;
|
||||||
Origin = Anchor.CentreLeft;
|
Origin = Anchor.CentreLeft;
|
||||||
|
LabelTextFlowContainer.Anchor = Anchor.CentreLeft;
|
||||||
|
LabelTextFlowContainer.Origin = Anchor.CentreLeft;
|
||||||
LabelText = @"Show hidden";
|
LabelText = @"Show hidden";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user