mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 12:42:54 +08:00
Collapse mod effect preview when it's not wide enough to fit
This commit is contained in:
parent
3deb6cb4ec
commit
d51396fdaf
@ -45,7 +45,7 @@ namespace osu.Game.Overlays.Mods
|
|||||||
|
|
||||||
public Bindable<IBeatmapInfo?> BeatmapInfo { get; } = new Bindable<IBeatmapInfo?>();
|
public Bindable<IBeatmapInfo?> BeatmapInfo { get; } = new Bindable<IBeatmapInfo?>();
|
||||||
|
|
||||||
public BindableBool Collapsed { get; } = new BindableBool();
|
public BindableBool Collapsed { get; } = new BindableBool(true);
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private Bindable<IReadOnlyList<Mod>> mods { get; set; } = null!;
|
private Bindable<IReadOnlyList<Mod>> mods { get; set; } = null!;
|
||||||
@ -173,6 +173,7 @@ namespace osu.Game.Overlays.Mods
|
|||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
Collapsed.BindValueChanged(collapsed => outerContent.FadeTo(collapsed.NewValue ? 0 : 1, transition_duration, Easing.OutQuint), true);
|
Collapsed.BindValueChanged(collapsed => outerContent.FadeTo(collapsed.NewValue ? 0 : 1, transition_duration, Easing.OutQuint), true);
|
||||||
|
FinishTransforms(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateValues() => Scheduler.AddOnce(() =>
|
private void updateValues() => Scheduler.AddOnce(() =>
|
||||||
|
@ -338,6 +338,15 @@ namespace osu.Game.Overlays.Mods
|
|||||||
base.Update();
|
base.Update();
|
||||||
|
|
||||||
SearchTextBox.PlaceholderText = SearchTextBox.HasFocus ? Resources.Localisation.Web.CommonStrings.InputSearch : ModSelectOverlayStrings.TabToSearch;
|
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>
|
/// <summary>
|
||||||
|
Loading…
Reference in New Issue
Block a user