Match settings panels' backgrounds visually and behaviourally

This commit is contained in:
Dean Herbert 2024-03-16 10:23:21 +08:00
parent 0f8d526453
commit a49c4ebea6
No known key found for this signature in database
1 changed files with 23 additions and 3 deletions

View File

@ -18,6 +18,8 @@ public partial class PlayerLoaderDisclaimer : CompositeDrawable
private readonly LocalisableString title;
private readonly LocalisableString content;
private Box background = null!;
public PlayerLoaderDisclaimer(LocalisableString title, LocalisableString content)
{
this.title = title;
@ -34,10 +36,11 @@ private void load(OsuColour colours, OverlayColourProvider colourProvider)
InternalChildren = new Drawable[]
{
new Box
background = new Box
{
RelativeSizeAxes = Axes.Both,
Colour = colourProvider.Background4,
Alpha = 0.1f,
},
new Container
{
@ -81,7 +84,24 @@ private void load(OsuColour colours, OverlayColourProvider colourProvider)
};
}
// handle hover so that users can hover the disclaimer to delay load if they want to read it.
protected override bool OnHover(HoverEvent e) => true;
protected override bool OnHover(HoverEvent e)
{
updateFadeState();
// handle hover so that users can hover the disclaimer to delay load if they want to read it.
return true;
}
protected override void OnHoverLost(HoverLostEvent e)
{
updateFadeState();
base.OnHoverLost(e);
}
private void updateFadeState()
{
// Matches SettingsToolboxGroup
background.FadeTo(IsHovered ? 1 : 0.1f, (float)500, Easing.OutQuint);
}
}
}