diff --git a/osu.Game/Graphics/UserInterface/ExpandingBar.cs b/osu.Game/Graphics/UserInterface/ExpandingBar.cs index 439a6002d8..60cb35b4c4 100644 --- a/osu.Game/Graphics/UserInterface/ExpandingBar.cs +++ b/osu.Game/Graphics/UserInterface/ExpandingBar.cs @@ -13,17 +13,17 @@ namespace osu.Game.Graphics.UserInterface /// public class ExpandingBar : Circle { - private bool isCollapsed; + private bool expanded = true; - public bool IsCollapsed + public bool Expanded { - get => isCollapsed; + get => expanded; set { - if (value == isCollapsed) + if (value == expanded) return; - isCollapsed = value; + expanded = value; updateState(); } } @@ -83,19 +83,21 @@ namespace osu.Game.Graphics.UserInterface updateState(); } - public void Collapse() => IsCollapsed = true; + public void Collapse() => Expanded = false; - public void Expand() => IsCollapsed = false; + public void Expand() => Expanded = true; private void updateState() { - float newSize = IsCollapsed ? CollapsedSize : ExpandedSize; - Easing easingType = IsCollapsed ? Easing.Out : Easing.OutElastic; + float newSize = expanded ? ExpandedSize : CollapsedSize; + Easing easingType = expanded ? Easing.OutElastic : Easing.Out; if (RelativeSizeAxes == Axes.X) this.ResizeHeightTo(newSize, 400, easingType); else this.ResizeWidthTo(newSize, 400, easingType); + + this.FadeTo(expanded ? 1 : 0.5f, 100, Easing.OutQuint); } } } diff --git a/osu.Game/Overlays/Changelog/UpdateStreamBadge.cs b/osu.Game/Overlays/Changelog/UpdateStreamBadge.cs index 97c58614b8..6786bbc49f 100644 --- a/osu.Game/Overlays/Changelog/UpdateStreamBadge.cs +++ b/osu.Game/Overlays/Changelog/UpdateStreamBadge.cs @@ -74,7 +74,7 @@ namespace osu.Game.Overlays.Changelog Colour = stream.Colour, ExpandedSize = 4, CollapsedSize = 2, - IsCollapsed = true + Expanded = true }, new HoverClickSounds() }); @@ -100,33 +100,39 @@ namespace osu.Game.Overlays.Changelog private void updateState() { - if (SelectedTab.Value == null && !allStreamsDimmed) + // highlighted regardless if we are hovered + bool textHighlighted = IsHovered; + bool barExpanded = IsHovered; + + if (SelectedTab.Value == null) { - expandingBar.Expand(); - expandingBar.FadeTo(1, transition_duration, Easing.OutQuint); - text.FadeTo(1, transition_duration, Easing.OutQuint); - return; + // at listing, all badges are highlighted when user is not hovering any badge. + textHighlighted |= !userHoveringArea; + barExpanded |= !userHoveringArea; + } + else + { + // bar is always expanded when active + barExpanded |= Active.Value; + + // text is highlighted only when hovered or active (but not if in selection mode) + textHighlighted |= Active.Value && !userHoveringArea; } - var shouldExpand = Active.Value || IsHovered; - - expandingBar.IsCollapsed = !shouldExpand; - expandingBar.FadeTo(shouldExpand ? 1 : 0.5f, transition_duration, Easing.OutQuint); - - text.FadeTo(IsHovered || (Active.Value && !allStreamsDimmed) ? 1 : 0.5f, transition_duration, Easing.OutQuint); + expandingBar.Expanded = barExpanded; + text.FadeTo(textHighlighted ? 1 : 0.5f, transition_duration, Easing.OutQuint); } - private bool allStreamsDimmed; + private bool userHoveringArea; - public bool AllStreamsDimmed + public bool UserHoveringArea { - get => allStreamsDimmed; set { - if (value == allStreamsDimmed) + if (value == userHoveringArea) return; - allStreamsDimmed = value; + userHoveringArea = value; updateState(); } } diff --git a/osu.Game/Overlays/Changelog/UpdateStreamBadgeArea.cs b/osu.Game/Overlays/Changelog/UpdateStreamBadgeArea.cs index 314f94101a..ffb622dd37 100644 --- a/osu.Game/Overlays/Changelog/UpdateStreamBadgeArea.cs +++ b/osu.Game/Overlays/Changelog/UpdateStreamBadgeArea.cs @@ -27,7 +27,7 @@ namespace osu.Game.Overlays.Changelog protected override bool OnHover(HoverEvent e) { foreach (var streamBadge in TabContainer.Children.OfType()) - streamBadge.AllStreamsDimmed = true; + streamBadge.UserHoveringArea = true; return base.OnHover(e); } @@ -35,7 +35,7 @@ namespace osu.Game.Overlays.Changelog protected override void OnHoverLost(HoverLostEvent e) { foreach (var streamBadge in TabContainer.Children.OfType()) - streamBadge.AllStreamsDimmed = false; + streamBadge.UserHoveringArea = false; base.OnHoverLost(e); }