1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-19 18:19:54 +08:00

Merge pull request #36580 from peppy/fix-revert-button-wrong-size

Fix revert to default button not resizing correctly after changing languages
This commit is contained in:
Bartłomiej Dach
2026-02-04 07:48:26 +01:00
committed by GitHub
Unverified
8 changed files with 17 additions and 7 deletions
@@ -139,5 +139,7 @@ namespace osu.Game.Graphics.UserInterfaceV2
public void SetDefault() => Current.SetDefault();
public bool IsDisabled => Current.Disabled;
public float MainDrawHeight => DrawHeight;
}
}
@@ -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,
@@ -631,5 +631,7 @@ namespace osu.Game.Graphics.UserInterfaceV2
public void SetDefault() => Current.SetDefault();
public bool IsDisabled => Current.Disabled;
public float MainDrawHeight => DrawHeight;
}
}
@@ -249,5 +249,7 @@ namespace osu.Game.Graphics.UserInterfaceV2
public bool IsDisabled => current.Disabled;
public IEnumerable<LocalisableString> FilterTerms => Caption.Yield();
public float MainDrawHeight => DrawHeight;
}
}
@@ -31,5 +31,11 @@ namespace osu.Game.Graphics.UserInterfaceV2
/// Whether the control is currently disabled.
/// </summary>
bool IsDisabled { get; }
/// <summary>
/// The height of the main part of the control (when not expanded).
/// This is used to attach external elements.
/// </summary>
float MainDrawHeight { get; }
}
}
@@ -136,6 +136,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input
{
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
RelativeSizeAxes = Axes.Y,
Action = RestoreDefaults,
},
new Container
+2 -6
View File
@@ -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
@@ -30,7 +30,6 @@ namespace osu.Game.Overlays.Settings
public SettingsRevertToDefaultButton()
{
RelativeSizeAxes = Axes.Y;
Width = WIDTH;
}