From d500f3605ef8c71f6a40256b86fe6a5a618d0558 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 9 Jun 2019 16:47:48 +0900 Subject: [PATCH 1/3] Fix checkboxes with long labels overlapping nub --- .../Graphics/UserInterface/OsuCheckbox.cs | 22 ++++++++++--------- .../Overlays/Settings/SettingsCheckbox.cs | 1 - 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/OsuCheckbox.cs b/osu.Game/Graphics/UserInterface/OsuCheckbox.cs index cd1147e3d3..dd126d8518 100644 --- a/osu.Game/Graphics/UserInterface/OsuCheckbox.cs +++ b/osu.Game/Graphics/UserInterface/OsuCheckbox.cs @@ -6,10 +6,9 @@ using osu.Framework.Audio; using osu.Framework.Audio.Sample; using osu.Framework.Bindables; using osu.Framework.Graphics; -using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; using osu.Framework.Input.Events; -using osu.Game.Graphics.Sprites; +using osu.Game.Graphics.Containers; using osuTK.Graphics; namespace osu.Game.Graphics.UserInterface @@ -33,7 +32,6 @@ namespace osu.Game.Graphics.UserInterface public string LabelText { - get => labelSpriteText?.Text; set { if (labelSpriteText != null) @@ -53,7 +51,7 @@ namespace osu.Game.Graphics.UserInterface protected readonly Nub Nub; - private readonly SpriteText labelSpriteText; + private readonly OsuTextFlowContainer labelSpriteText; private SampleChannel sampleChecked; private SampleChannel sampleUnchecked; @@ -62,24 +60,28 @@ namespace osu.Game.Graphics.UserInterface AutoSizeAxes = Axes.Y; RelativeSizeAxes = Axes.X; + const float nub_padding = 5; + Children = new Drawable[] { - labelSpriteText = new OsuSpriteText(), + labelSpriteText = new OsuTextFlowContainer + { + 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 = 5 }, + Margin = new MarginPadding { Right = nub_padding }, }, new HoverClickSounds() }; Nub.Current.BindTo(Current); - Current.DisabledChanged += disabled => - { - labelSpriteText.Alpha = Nub.Alpha = disabled ? 0.3f : 1; - }; + Current.DisabledChanged += disabled => { labelSpriteText.Alpha = Nub.Alpha = disabled ? 0.3f : 1; }; } protected override void LoadComplete() diff --git a/osu.Game/Overlays/Settings/SettingsCheckbox.cs b/osu.Game/Overlays/Settings/SettingsCheckbox.cs index 46c23c3bbf..a1501d8015 100644 --- a/osu.Game/Overlays/Settings/SettingsCheckbox.cs +++ b/osu.Game/Overlays/Settings/SettingsCheckbox.cs @@ -14,7 +14,6 @@ namespace osu.Game.Overlays.Settings public override string LabelText { - get => checkbox.LabelText; set => checkbox.LabelText = value; } } From cd89633dee31f80d9181a00467b00159ae20cf76 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 9 Jun 2019 17:07:23 +0900 Subject: [PATCH 2/3] Rename variable to match --- osu.Game/Graphics/UserInterface/OsuCheckbox.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/OsuCheckbox.cs b/osu.Game/Graphics/UserInterface/OsuCheckbox.cs index dd126d8518..5d41075725 100644 --- a/osu.Game/Graphics/UserInterface/OsuCheckbox.cs +++ b/osu.Game/Graphics/UserInterface/OsuCheckbox.cs @@ -34,24 +34,24 @@ namespace osu.Game.Graphics.UserInterface { set { - if (labelSpriteText != null) - labelSpriteText.Text = value; + if (labelText != null) + labelText.Text = value; } } public MarginPadding LabelPadding { - get => labelSpriteText?.Padding ?? new MarginPadding(); + get => labelText?.Padding ?? new MarginPadding(); set { - if (labelSpriteText != null) - labelSpriteText.Padding = value; + if (labelText != null) + labelText.Padding = value; } } protected readonly Nub Nub; - private readonly OsuTextFlowContainer labelSpriteText; + private readonly OsuTextFlowContainer labelText; private SampleChannel sampleChecked; private SampleChannel sampleUnchecked; @@ -64,7 +64,7 @@ namespace osu.Game.Graphics.UserInterface Children = new Drawable[] { - labelSpriteText = new OsuTextFlowContainer + labelText = new OsuTextFlowContainer { AutoSizeAxes = Axes.Y, RelativeSizeAxes = Axes.X, @@ -81,7 +81,7 @@ namespace osu.Game.Graphics.UserInterface Nub.Current.BindTo(Current); - Current.DisabledChanged += disabled => { labelSpriteText.Alpha = Nub.Alpha = disabled ? 0.3f : 1; }; + Current.DisabledChanged += disabled => { labelText.Alpha = Nub.Alpha = disabled ? 0.3f : 1; }; } protected override void LoadComplete() From e5417416a23a0ef743a53589ee42e5362f0f6937 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 11 Jun 2019 18:24:50 +0900 Subject: [PATCH 3/3] Remove braces --- osu.Game/Graphics/UserInterface/OsuCheckbox.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Graphics/UserInterface/OsuCheckbox.cs b/osu.Game/Graphics/UserInterface/OsuCheckbox.cs index 5d41075725..5ead5987a1 100644 --- a/osu.Game/Graphics/UserInterface/OsuCheckbox.cs +++ b/osu.Game/Graphics/UserInterface/OsuCheckbox.cs @@ -81,7 +81,7 @@ namespace osu.Game.Graphics.UserInterface 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; } protected override void LoadComplete()