Adjust back button to match style better

This commit is contained in:
Dean Herbert 2023-12-27 02:54:24 +09:00
parent 8e13f65c5d
commit 5d0b524794
No known key found for this signature in database
3 changed files with 16 additions and 7 deletions

View File

@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Input.Events;
using osu.Game.Graphics.UserInterface;
@ -23,6 +24,7 @@ protected SidebarButton(HoverSampleSet? hoverSounds = HoverSampleSet.ButtonSideb
private void load()
{
BackgroundColour = ColourProvider.Background5;
Hover.Colour = ColourProvider.Light4;
}
protected override void LoadComplete()
@ -40,6 +42,9 @@ protected override bool OnHover(HoverEvent e)
protected override void OnHoverLost(HoverLostEvent e) => UpdateState();
protected abstract void UpdateState();
protected virtual void UpdateState()
{
Hover.FadeTo(IsHovered ? 0.1f : 0, FADE_DURATION, Easing.OutQuint);
}
}
}

View File

@ -111,12 +111,11 @@ public SidebarIconButton()
private void load()
{
selectionIndicator.Colour = ColourProvider.Highlight1;
Hover.Colour = ColourProvider.Light4;
}
protected override void UpdateState()
{
Hover.FadeTo(IsHovered ? 0.1f : 0, FADE_DURATION, Easing.OutQuint);
base.UpdateState();
if (Selected)
{

View File

@ -47,7 +47,9 @@ public BackButton()
[BackgroundDependencyLoader]
private void load()
{
Size = new Vector2(SettingsSidebar.DEFAULT_WIDTH);
Size = new Vector2(SettingsSidebar.EXPANDED_WIDTH);
Padding = new MarginPadding(5);
AddRange(new Drawable[]
{
@ -61,7 +63,8 @@ private void load()
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Size = new Vector2(15),
Y = -5,
Size = new Vector2(30),
Shadow = true,
Icon = FontAwesome.Solid.ChevronLeft
},
@ -69,8 +72,8 @@ private void load()
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Y = 15,
Font = OsuFont.GetFont(size: 12, weight: FontWeight.Bold),
Y = 30,
Font = OsuFont.GetFont(size: 16, weight: FontWeight.Regular),
Text = @"back",
},
}
@ -80,6 +83,8 @@ private void load()
protected override void UpdateState()
{
base.UpdateState();
content.FadeColour(IsHovered ? ColourProvider.Light1 : ColourProvider.Light3, FADE_DURATION, Easing.OutQuint);
}
}