Make beatmap card icon buttons fill up to the area

This commit is contained in:
Salman Ahmed 2022-10-13 15:52:20 +03:00
parent aa8040d696
commit 6c316bcc9e
6 changed files with 22 additions and 15 deletions

View File

@ -59,8 +59,9 @@ namespace osu.Game.Tests.Visual.Beatmaps
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Size = new Vector2(25f, 50f),
Scale = new Vector2(2f),
State = { Value = DownloadState.NotDownloaded },
Scale = new Vector2(2)
};
});
}

View File

@ -37,7 +37,11 @@ namespace osu.Game.Tests.Visual.Beatmaps
beatmapSetInfo = CreateAPIBeatmapSet(Ruleset.Value);
beatmapSetInfo.HasFavourited = favourited;
});
AddStep("create button", () => Child = button = new FavouriteButton(beatmapSetInfo) { Scale = new Vector2(2) });
AddStep("create button", () => Child = button = new FavouriteButton(beatmapSetInfo)
{
Size = new Vector2(25f, 50f),
Scale = new Vector2(2f),
});
assertCorrectIcon(favourited);
AddAssert("correct tooltip text", () => button.TooltipText == (favourited ? BeatmapsetsStrings.ShowDetailsUnfavourite : BeatmapsetsStrings.ShowDetailsFavourite));
@ -51,7 +55,11 @@ namespace osu.Game.Tests.Visual.Beatmaps
BeatmapFavouriteAction? lastRequestAction = null;
AddStep("create beatmap set", () => beatmapSetInfo = CreateAPIBeatmapSet(Ruleset.Value));
AddStep("create button", () => Child = button = new FavouriteButton(beatmapSetInfo) { Scale = new Vector2(2) });
AddStep("create button", () => Child = button = new FavouriteButton(beatmapSetInfo)
{
Size = new Vector2(25f, 50f),
Scale = new Vector2(2f),
});
assertCorrectIcon(false);

View File

@ -81,7 +81,6 @@ namespace osu.Game.Beatmaps.Drawables.Cards
FavouriteState = { BindTarget = FavouriteState },
ButtonsCollapsedWidth = CORNER_RADIUS,
ButtonsExpandedWidth = 30,
ButtonsPadding = new MarginPadding { Vertical = 35 },
Children = new Drawable[]
{
new FillFlowContainer

View File

@ -82,7 +82,6 @@ namespace osu.Game.Beatmaps.Drawables.Cards
FavouriteState = { BindTarget = FavouriteState },
ButtonsCollapsedWidth = CORNER_RADIUS,
ButtonsExpandedWidth = 30,
ButtonsPadding = new MarginPadding { Vertical = 17.5f },
Children = new Drawable[]
{
new FillFlowContainer

View File

@ -92,7 +92,6 @@ namespace osu.Game.Beatmaps.Drawables.Cards.Buttons
}
});
Size = new Vector2(24);
IconSize = 12;
}

View File

@ -48,12 +48,6 @@ namespace osu.Game.Beatmaps.Drawables.Cards
}
}
public MarginPadding ButtonsPadding
{
get => buttons.Padding;
set => buttons.Padding = value;
}
protected override Container<Drawable> Content => mainContent;
private readonly Container background;
@ -104,25 +98,32 @@ namespace osu.Game.Beatmaps.Drawables.Cards
Child = buttons = new Container<BeatmapCardIconButton>
{
RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding(3),
Children = new BeatmapCardIconButton[]
{
new FavouriteButton(beatmapSet)
{
Current = FavouriteState,
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre
Origin = Anchor.TopCentre,
RelativeSizeAxes = Axes.Both,
Height = 0.48f,
},
new DownloadButton(beatmapSet)
{
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
State = { BindTarget = downloadTracker.State }
State = { BindTarget = downloadTracker.State },
RelativeSizeAxes = Axes.Both,
Height = 0.48f,
},
new GoToBeatmapButton(beatmapSet)
{
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
State = { BindTarget = downloadTracker.State }
State = { BindTarget = downloadTracker.State },
RelativeSizeAxes = Axes.Both,
Height = 0.48f,
}
}
}