1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-24 19:17:20 +08:00

Give skinnable mod display a minimum size

Co-authored-by: Dean Herbert <pe@ppy.sh>
This commit is contained in:
Bartłomiej Dach 2024-12-20 12:06:26 +01:00
parent 55dff1f0ef
commit 4551d59f39
No known key found for this signature in database
2 changed files with 12 additions and 2 deletions

View File

@ -22,6 +22,8 @@ namespace osu.Game.Screens.Play.HUD
/// </summary>
public partial class ModDisplay : CompositeDrawable, IHasCurrentValue<IReadOnlyList<Mod>>
{
public const float MOD_ICON_SCALE = 0.6f;
private ExpansionMode expansionMode = ExpansionMode.ExpandOnHover;
public ExpansionMode ExpansionMode
@ -93,7 +95,7 @@ namespace osu.Game.Screens.Play.HUD
iconsContainer.Clear();
foreach (Mod mod in mods.NewValue.AsOrdered())
iconsContainer.Add(new ModIcon(mod, showExtendedInformation: showExtendedInformation) { Scale = new Vector2(0.6f) });
iconsContainer.Add(new ModIcon(mod, showExtendedInformation: showExtendedInformation) { Scale = new Vector2(MOD_ICON_SCALE) });
}
private void updateExpansionMode(double duration = 500)

View File

@ -10,6 +10,8 @@ using osu.Game.Configuration;
using osu.Game.Rulesets.Mods;
using osu.Game.Skinning;
using osu.Game.Localisation.SkinComponents;
using osu.Game.Rulesets.UI;
using osuTK;
namespace osu.Game.Screens.Play.HUD
{
@ -32,7 +34,13 @@ namespace osu.Game.Screens.Play.HUD
[BackgroundDependencyLoader]
private void load()
{
InternalChild = modDisplay = new ModDisplay();
InternalChildren = new Drawable[]
{
// Provide a minimum autosize.
new Container { Size = ModIcon.MOD_ICON_SIZE * ModDisplay.MOD_ICON_SCALE },
modDisplay = new ModDisplay(),
};
modDisplay.Current = mods;
AutoSizeAxes = Axes.Both;
}