1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 02:02:53 +08:00

Add collapsed state to effect preview panel

This commit is contained in:
Bartłomiej Dach 2023-09-11 10:16:24 +02:00
parent ff6bf0bc2c
commit f9d4fbee56
No known key found for this signature in database
2 changed files with 10 additions and 1 deletions

View File

@ -108,6 +108,8 @@ namespace osu.Game.Tests.Visual.UserInterface
if (panel.IsNotNull())
doubleTime.SpeedChange.Value = rate;
});
AddToggleStep("toggle collapsed", collapsed => panel.Collapsed.Value = collapsed);
}
private void previewStarRating(double stars)

View File

@ -35,6 +35,7 @@ namespace osu.Game.Overlays.Mods
private StarRatingDisplay starRatingDisplay = null!;
private BPMDisplay bpmDisplay = null!;
private FillFlowContainer<VerticalAttributeDisplay> outerContent = null!;
private VerticalAttributeDisplay circleSizeDisplay = null!;
private VerticalAttributeDisplay drainRateDisplay = null!;
private VerticalAttributeDisplay approachRateDisplay = null!;
@ -44,6 +45,8 @@ namespace osu.Game.Overlays.Mods
public Bindable<IBeatmapInfo?> BeatmapInfo { get; } = new Bindable<IBeatmapInfo?>();
public BindableBool Collapsed { get; } = new BindableBool();
[Resolved]
private Bindable<IReadOnlyList<Mod>> mods { get; set; } = null!;
@ -69,6 +72,8 @@ namespace osu.Game.Overlays.Mods
Origin = Anchor.BottomRight,
Anchor = Anchor.BottomRight,
AutoSizeAxes = Axes.X,
AutoSizeEasing = Easing.OutQuint,
AutoSizeDuration = transition_duration,
Height = ShearedButton.HEIGHT,
Shear = new Vector2(shear, 0),
CornerRadius = ShearedButton.CORNER_RADIUS,
@ -127,7 +132,7 @@ namespace osu.Game.Overlays.Mods
}
}
},
new FillFlowContainer<VerticalAttributeDisplay> // outer content
outerContent = new FillFlowContainer<VerticalAttributeDisplay>
{
Origin = Anchor.CentreLeft,
Anchor = Anchor.CentreLeft,
@ -166,6 +171,8 @@ namespace osu.Game.Overlays.Mods
modSettingChangeTracker.SettingChanged += _ => updateValues();
updateValues();
}, true);
Collapsed.BindValueChanged(collapsed => outerContent.FadeTo(collapsed.NewValue ? 0 : 1, transition_duration, Easing.OutQuint), true);
}
private void updateValues() => Scheduler.AddOnce(() =>