badge_size is the actual badge size now

also fixes rotateBadges bug when hover is lost
This commit is contained in:
jorolf 2018-04-16 18:27:18 +02:00
parent 6ca714d93b
commit af0c49cca8

View File

@ -19,9 +19,8 @@ namespace osu.Game.Overlays.Profile.Header
{ {
public class BadgeContainer : Container public class BadgeContainer : Container
{ {
private const float outer_container_width = 98; private static readonly Vector2 badge_size = new Vector2(86, 40);
private const float outer_container_padding = 3; private static readonly MarginPadding outer_padding = new MarginPadding(3);
private static readonly Vector2 badge_size = new Vector2(outer_container_width - outer_container_padding * 2, 46);
private OsuSpriteText badgeCountText; private OsuSpriteText badgeCountText;
private FillFlowContainer badgeFlowContainer; private FillFlowContainer badgeFlowContainer;
@ -49,8 +48,8 @@ namespace osu.Game.Overlays.Profile.Header
Anchor = Anchor.BottomLeft, Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft, Origin = Anchor.BottomLeft,
Direction = FillDirection.Vertical, Direction = FillDirection.Vertical,
Padding = new MarginPadding(outer_container_padding), Padding = outer_padding,
Width = outer_container_width, Width = badge_size.X + outer_padding.TotalHorizontal * 2,
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
Children = new Drawable[] Children = new Drawable[]
{ {
@ -117,7 +116,7 @@ namespace osu.Game.Overlays.Profile.Header
{ {
LoadComponentAsync(new DrawableBadge(badge) LoadComponentAsync(new DrawableBadge(badge)
{ {
Size = badge_size, Size = badge_size + outer_padding.Total,
}, badgeFlowContainer.Add); }, badgeFlowContainer.Add);
} }
} }
@ -134,10 +133,10 @@ namespace osu.Game.Overlays.Profile.Header
private void onOuterHoverLost() private void onOuterHoverLost()
{ {
rotateBadges(); badgeFlowContainer.MoveToX(-badge_size.X * visibleBadge, 500, Easing.InOutQuad);
badgeFlowContainer.Direction = FillDirection.Horizontal; badgeFlowContainer.Direction = FillDirection.Horizontal;
outerBadgeContainer.AutoSizeAxes = Axes.Y; outerBadgeContainer.AutoSizeAxes = Axes.Y;
outerBadgeContainer.Width = outer_container_width; outerBadgeContainer.Width = badge_size.X + outer_padding.TotalHorizontal * 2;
} }
private class OuterBadgeContainer : FillFlowContainer private class OuterBadgeContainer : FillFlowContainer