1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 22:07:25 +08:00

Fix multiple highlighting issues with beatmap listing tab items

This commit is contained in:
Salman Ahmed 2023-01-06 15:13:31 +03:00
parent 3c74d27deb
commit 0ade4d92d1
2 changed files with 9 additions and 6 deletions

View File

@ -103,8 +103,7 @@ namespace osu.Game.Overlays.BeatmapListing
{
private readonly Box selectedUnderline;
[Resolved]
private OverlayColourProvider colourProvider { get; set; }
protected override bool HighlightOnHoverWhenActive => true;
public MultipleSelectionFilterTabItem(T value)
: base(value)
@ -125,7 +124,7 @@ namespace osu.Game.Overlays.BeatmapListing
{
base.UpdateState();
selectedUnderline.FadeTo(Active.Value ? 1 : 0, 200, Easing.OutQuint);
selectedUnderline.FadeColour(IsHovered ? colourProvider.Light1 : GetStateColour(), 200, Easing.OutQuint);
selectedUnderline.FadeColour(IsHovered ? ColourProvider.Content2 : GetStateColour(), 200, Easing.OutQuint);
}
protected override bool OnClick(ClickEvent e)

View File

@ -20,7 +20,7 @@ namespace osu.Game.Overlays.BeatmapListing
public partial class FilterTabItem<T> : TabItem<T>
{
[Resolved]
private OverlayColourProvider colourProvider { get; set; }
protected OverlayColourProvider ColourProvider { get; private set; }
private OsuSpriteText text;
@ -78,12 +78,16 @@ namespace osu.Game.Overlays.BeatmapListing
/// </summary>
protected virtual LocalisableString LabelFor(T value) => (value as Enum)?.GetLocalisableDescription() ?? value.ToString();
protected virtual bool HighlightOnHoverWhenActive => false;
protected virtual void UpdateState()
{
text.FadeColour(IsHovered ? colourProvider.Light1 : GetStateColour(), 200, Easing.OutQuint);
bool highlightHover = IsHovered && (!Active.Value || HighlightOnHoverWhenActive);
text.FadeColour(highlightHover ? ColourProvider.Content2 : GetStateColour(), 200, Easing.OutQuint);
text.Font = text.Font.With(weight: Active.Value ? FontWeight.SemiBold : FontWeight.Regular);
}
protected virtual Color4 GetStateColour() => Active.Value ? colourProvider.Content1 : colourProvider.Light2;
protected virtual Color4 GetStateColour() => Active.Value ? ColourProvider.Content1 : ColourProvider.Light2;
}
}