1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 15:33:05 +08:00

Merge pull request #15978 from peppy/beatmap-card/scale-on-hover

Scale card when expanding to better distinguish hovered card from other cards in listing
This commit is contained in:
Dean Herbert 2021-12-08 11:18:07 +09:00 committed by GitHub
commit f86931b66f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 1 deletions

View File

@ -285,7 +285,13 @@ namespace osu.Game.Beatmaps.Drawables.Cards
content.ScheduleShow();
return false;
},
Unhovered = _ => content.ScheduleHide()
Unhovered = _ =>
{
// This hide should only trigger if the expanded content has not shown yet.
// ie. if the user has not shown intent to want to see it (quickly moved over the info row area).
if (!Expanded.Value)
content.ScheduleHide();
}
}
}
},
@ -360,6 +366,8 @@ namespace osu.Game.Beatmaps.Drawables.Cards
protected override void OnHoverLost(HoverLostEvent e)
{
content.ScheduleHide();
updateState();
base.OnHoverLost(e);
}
@ -398,6 +406,10 @@ namespace osu.Game.Beatmaps.Drawables.Cards
thumbnail.Dimmed.Value = showDetails;
// Scale value is intentionally chosen to fit in the spacing of listing displays, as to not overlap horizontally with adjacent cards.
// This avoids depth issues where a hovered (scaled) card to the right of another card would be beneath the card to the left.
content.ScaleTo(Expanded.Value ? 1.03f : 1, 500, Easing.OutQuint);
mainContent.ResizeWidthTo(targetWidth, TRANSITION_DURATION, Easing.OutQuint);
mainContentBackground.Dimmed.Value = showDetails;

View File

@ -45,6 +45,9 @@ namespace osu.Game.Beatmaps.Drawables.Cards
RelativeSizeAxes = Axes.X;
Height = height;
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
InternalChild = content = new HoverHandlingContainer
{
RelativeSizeAxes = Axes.X,