mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 22:22:54 +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:
commit
f86931b66f
@ -285,7 +285,13 @@ namespace osu.Game.Beatmaps.Drawables.Cards
|
|||||||
content.ScheduleShow();
|
content.ScheduleShow();
|
||||||
return false;
|
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)
|
protected override void OnHoverLost(HoverLostEvent e)
|
||||||
{
|
{
|
||||||
|
content.ScheduleHide();
|
||||||
|
|
||||||
updateState();
|
updateState();
|
||||||
base.OnHoverLost(e);
|
base.OnHoverLost(e);
|
||||||
}
|
}
|
||||||
@ -398,6 +406,10 @@ namespace osu.Game.Beatmaps.Drawables.Cards
|
|||||||
|
|
||||||
thumbnail.Dimmed.Value = showDetails;
|
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);
|
mainContent.ResizeWidthTo(targetWidth, TRANSITION_DURATION, Easing.OutQuint);
|
||||||
mainContentBackground.Dimmed.Value = showDetails;
|
mainContentBackground.Dimmed.Value = showDetails;
|
||||||
|
|
||||||
|
@ -45,6 +45,9 @@ namespace osu.Game.Beatmaps.Drawables.Cards
|
|||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
Height = height;
|
Height = height;
|
||||||
|
|
||||||
|
Anchor = Anchor.Centre;
|
||||||
|
Origin = Anchor.Centre;
|
||||||
|
|
||||||
InternalChild = content = new HoverHandlingContainer
|
InternalChild = content = new HoverHandlingContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
|
Loading…
Reference in New Issue
Block a user