diff --git a/osu.Game/Graphics/UserInterfaceV2/FormCheckBox.cs b/osu.Game/Graphics/UserInterfaceV2/FormCheckBox.cs index 2709dde164..e15372d18b 100644 --- a/osu.Game/Graphics/UserInterfaceV2/FormCheckBox.cs +++ b/osu.Game/Graphics/UserInterfaceV2/FormCheckBox.cs @@ -139,5 +139,7 @@ namespace osu.Game.Graphics.UserInterfaceV2 public void SetDefault() => Current.SetDefault(); public bool IsDisabled => Current.Disabled; + + public float MainDrawHeight => DrawHeight; } } diff --git a/osu.Game/Graphics/UserInterfaceV2/FormDropdown.cs b/osu.Game/Graphics/UserInterfaceV2/FormDropdown.cs index 96dda47958..7ac305a500 100644 --- a/osu.Game/Graphics/UserInterfaceV2/FormDropdown.cs +++ b/osu.Game/Graphics/UserInterfaceV2/FormDropdown.cs @@ -80,6 +80,8 @@ namespace osu.Game.Graphics.UserInterfaceV2 public bool IsDisabled => Current.Disabled; + public float MainDrawHeight => header.DrawHeight; + protected override DropdownHeader CreateHeader() => header = new FormDropdownHeader { Dropdown = this, diff --git a/osu.Game/Graphics/UserInterfaceV2/FormSliderBar.cs b/osu.Game/Graphics/UserInterfaceV2/FormSliderBar.cs index 501e3106b3..6f51b94750 100644 --- a/osu.Game/Graphics/UserInterfaceV2/FormSliderBar.cs +++ b/osu.Game/Graphics/UserInterfaceV2/FormSliderBar.cs @@ -631,5 +631,7 @@ namespace osu.Game.Graphics.UserInterfaceV2 public void SetDefault() => Current.SetDefault(); public bool IsDisabled => Current.Disabled; + + public float MainDrawHeight => DrawHeight; } } diff --git a/osu.Game/Graphics/UserInterfaceV2/FormTextBox.cs b/osu.Game/Graphics/UserInterfaceV2/FormTextBox.cs index 78fb438828..7b97c8baf3 100644 --- a/osu.Game/Graphics/UserInterfaceV2/FormTextBox.cs +++ b/osu.Game/Graphics/UserInterfaceV2/FormTextBox.cs @@ -249,5 +249,7 @@ namespace osu.Game.Graphics.UserInterfaceV2 public bool IsDisabled => current.Disabled; public IEnumerable FilterTerms => Caption.Yield(); + + public float MainDrawHeight => DrawHeight; } } diff --git a/osu.Game/Graphics/UserInterfaceV2/IFormControl.cs b/osu.Game/Graphics/UserInterfaceV2/IFormControl.cs index 97630a649a..4c59cc3235 100644 --- a/osu.Game/Graphics/UserInterfaceV2/IFormControl.cs +++ b/osu.Game/Graphics/UserInterfaceV2/IFormControl.cs @@ -31,5 +31,11 @@ namespace osu.Game.Graphics.UserInterfaceV2 /// Whether the control is currently disabled. /// bool IsDisabled { get; } + + /// + /// The height of the main part of the control (when not expanded). + /// This is used to attach external elements. + /// + float MainDrawHeight { get; } } } diff --git a/osu.Game/Overlays/Settings/Sections/Input/KeyBindingRow.cs b/osu.Game/Overlays/Settings/Sections/Input/KeyBindingRow.cs index c45d76e331..cb839b92e7 100644 --- a/osu.Game/Overlays/Settings/Sections/Input/KeyBindingRow.cs +++ b/osu.Game/Overlays/Settings/Sections/Input/KeyBindingRow.cs @@ -136,6 +136,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input { Anchor = Anchor.TopRight, Origin = Anchor.TopRight, + RelativeSizeAxes = Axes.Y, Action = RestoreDefaults, }, new Container diff --git a/osu.Game/Overlays/Settings/SettingsItemV2.cs b/osu.Game/Overlays/Settings/SettingsItemV2.cs index 78f3b0eb0a..0a3830334e 100644 --- a/osu.Game/Overlays/Settings/SettingsItemV2.cs +++ b/osu.Game/Overlays/Settings/SettingsItemV2.cs @@ -85,12 +85,6 @@ namespace osu.Game.Overlays.Settings controlDefault.BindValueChanged(_ => updateDefaultState()); controlEnabled.BindValueChanged(_ => updateDefaultState(), true); FinishTransforms(true); - - ScheduleAfterChildren(() => - { - revertButton.RelativeSizeAxes = Axes.None; - revertButton.Height = ((Drawable)Control).DrawHeight; - }); } private void updateDefaultState() @@ -108,6 +102,8 @@ namespace osu.Game.Overlays.Settings base.Update(); controlDefault.Value = Control.IsDefault; controlEnabled.Value = !Control.IsDisabled; + + revertButton.Height = Control.MainDrawHeight; } #region ISettingsItem diff --git a/osu.Game/Overlays/Settings/SettingsRevertToDefaultButton.cs b/osu.Game/Overlays/Settings/SettingsRevertToDefaultButton.cs index f828287d52..fc8b492656 100644 --- a/osu.Game/Overlays/Settings/SettingsRevertToDefaultButton.cs +++ b/osu.Game/Overlays/Settings/SettingsRevertToDefaultButton.cs @@ -30,7 +30,6 @@ namespace osu.Game.Overlays.Settings public SettingsRevertToDefaultButton() { - RelativeSizeAxes = Axes.Y; Width = WIDTH; }