1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 05:02:55 +08:00

Merge pull request #24796 from peppy/collapse-preset-column

Collapse mod presets column slightly when not in use
This commit is contained in:
Bartłomiej Dach 2023-09-14 11:07:36 +02:00 committed by GitHub
commit 2d3be819d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 2 deletions

View File

@ -26,6 +26,8 @@ namespace osu.Game.Overlays.Mods
[Resolved] [Resolved]
private IBindable<RulesetInfo> ruleset { get; set; } = null!; private IBindable<RulesetInfo> ruleset { get; set; } = null!;
private const float contracted_width = WIDTH - 120;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuColour colours) private void load(OsuColour colours)
{ {
@ -42,6 +44,8 @@ namespace osu.Game.Overlays.Mods
base.LoadComplete(); base.LoadComplete();
ruleset.BindValueChanged(_ => rulesetChanged(), true); ruleset.BindValueChanged(_ => rulesetChanged(), true);
Width = contracted_width;
} }
private IDisposable? presetSubscription; private IDisposable? presetSubscription;
@ -65,7 +69,11 @@ namespace osu.Game.Overlays.Mods
{ {
cancellationTokenSource?.Cancel(); cancellationTokenSource?.Cancel();
if (!presets.Any()) bool hasPresets = presets.Any();
this.ResizeWidthTo(hasPresets ? WIDTH : contracted_width, 200, Easing.OutQuint);
if (!hasPresets)
{ {
removeAndDisposePresetPanels(); removeAndDisposePresetPanels();
return; return;

View File

@ -61,9 +61,11 @@ namespace osu.Game.Overlays.Mods
private const float header_height = 42; private const float header_height = 42;
protected const float WIDTH = 320;
protected ModSelectColumn() protected ModSelectColumn()
{ {
Width = 320; Width = WIDTH;
RelativeSizeAxes = Axes.Y; RelativeSizeAxes = Axes.Y;
Shear = new Vector2(ShearedOverlayContainer.SHEAR, 0); Shear = new Vector2(ShearedOverlayContainer.SHEAR, 0);