1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 06:42:56 +08:00

Collapse mod effect preview when it's not wide enough to fit

This commit is contained in:
Bartłomiej Dach 2023-09-11 10:46:07 +02:00
parent 3deb6cb4ec
commit d51396fdaf
No known key found for this signature in database
2 changed files with 11 additions and 1 deletions

View File

@ -45,7 +45,7 @@ namespace osu.Game.Overlays.Mods
public Bindable<IBeatmapInfo?> BeatmapInfo { get; } = new Bindable<IBeatmapInfo?>();
public BindableBool Collapsed { get; } = new BindableBool();
public BindableBool Collapsed { get; } = new BindableBool(true);
[Resolved]
private Bindable<IReadOnlyList<Mod>> mods { get; set; } = null!;
@ -173,6 +173,7 @@ namespace osu.Game.Overlays.Mods
}, true);
Collapsed.BindValueChanged(collapsed => outerContent.FadeTo(collapsed.NewValue ? 0 : 1, transition_duration, Easing.OutQuint), true);
FinishTransforms(true);
}
private void updateValues() => Scheduler.AddOnce(() =>

View File

@ -338,6 +338,15 @@ namespace osu.Game.Overlays.Mods
base.Update();
SearchTextBox.PlaceholderText = SearchTextBox.HasFocus ? Resources.Localisation.Web.CommonStrings.InputSearch : ModSelectOverlayStrings.TabToSearch;
if (modEffectPreviewPanel != null)
{
float rightEdgeOfLastButton = footerButtonFlow.Last().ScreenSpaceDrawQuad.TopRight.X;
// this is cheating a bit; the 375 value is hardcoded based on how wide the expanded panel _generally_ is.
// due to the transition applied, the raw screenspace quad of the panel cannot be used, as it will trigger an ugly feedback cycle of expanding and collapsing.
float projectedLeftEdgeOfExpandedModEffectPreviewPanel = footerButtonFlow.ToScreenSpace(footerButtonFlow.DrawSize - new Vector2(375 + 70, 0)).X;
modEffectPreviewPanel.Collapsed.Value = rightEdgeOfLastButton > projectedLeftEdgeOfExpandedModEffectPreviewPanel;
}
}
/// <summary>