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

Use relative sizing for MonthDropdown

This commit is contained in:
Andrei Zavatski 2021-05-11 16:51:59 +03:00
parent 1c0b0996cf
commit c2ba16f977
3 changed files with 27 additions and 38 deletions

View File

@ -22,31 +22,21 @@ namespace osu.Game.Tests.Visual.Online
[Test]
public void CreateClosedMonthPanel()
{
AddStep("Create", () => Child = new Container
{
Anchor = Anchor.Centre,
Origin = Anchor.TopCentre,
AutoSizeAxes = Axes.Both,
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = colourProvider.Background2,
},
new MonthDropdown(posts),
}
});
create(false);
}
[Test]
public void CreateOpenMonthPanel()
{
AddStep("Create", () => Child = new Container
create(true);
}
private void create(bool isOpen) => AddStep("Create", () => Child = new Container
{
Anchor = Anchor.Centre,
Origin = Anchor.TopCentre,
AutoSizeAxes = Axes.Both,
AutoSizeAxes = Axes.Y,
Width = 160,
Children = new Drawable[]
{
new Box
@ -56,11 +46,10 @@ namespace osu.Game.Tests.Visual.Online
},
new MonthDropdown(posts)
{
IsOpen = { Value = true }
},
IsOpen = { Value = isOpen }
}
}
});
}
private static List<APINewsPost> posts => new List<APINewsPost>
{

View File

@ -28,7 +28,7 @@ namespace osu.Game.Overlays.News.Sidebar
public MonthDropdown(IEnumerable<APINewsPost> posts)
{
Width = 160;
RelativeSizeAxes = Axes.X;
Masking = true;
InternalChild = new FillFlowContainer
{

View File

@ -42,17 +42,17 @@ namespace osu.Game.Overlays.News.Sidebar
},
Child = new FillFlowContainer
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Direction = FillDirection.Vertical,
AutoSizeAxes = Axes.Both,
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Spacing = new Vector2(0, 20),
Children = new Drawable[]
{
new YearsPanel(),
monthsFlow = new FillFlowContainer<MonthDropdown>
{
AutoSizeAxes = Axes.Both,
AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X,
Direction = FillDirection.Vertical,
Spacing = new Vector2(0, 10)
}