1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-14 15:57:24 +08:00

Merge pull request #27541 from Joehuu/wrap-beatmap-listing-filters

Wrap beatmap listing filters and match web spacing
This commit is contained in:
Bartłomiej Dach 2024-03-11 15:29:38 +01:00 committed by GitHub
commit 2b40effbdb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 13 additions and 38 deletions

View File

@ -128,6 +128,7 @@ namespace osu.Game.Overlays.BeatmapListing
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Direction = FillDirection.Vertical, Direction = FillDirection.Vertical,
Padding = new MarginPadding { Horizontal = 10 }, Padding = new MarginPadding { Horizontal = 10 },
Spacing = new Vector2(5),
Children = new Drawable[] Children = new Drawable[]
{ {
generalFilter = new BeatmapSearchGeneralFilterRow(), generalFilter = new BeatmapSearchGeneralFilterRow(),

View File

@ -1,17 +1,15 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.UserInterface; using osu.Framework.Graphics.UserInterface;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
using osuTK; using osuTK;
using osu.Framework.Extensions.EnumExtensions; using osu.Framework.Extensions.EnumExtensions;
using osu.Framework.Localisation; using osu.Framework.Localisation;
using osu.Game.Graphics.Containers;
namespace osu.Game.Overlays.BeatmapListing namespace osu.Game.Overlays.BeatmapListing
{ {
@ -47,11 +45,10 @@ namespace osu.Game.Overlays.BeatmapListing
{ {
new[] new[]
{ {
new OsuSpriteText new OsuTextFlowContainer(t => t.Font = OsuFont.GetFont(size: 13))
{ {
Anchor = Anchor.BottomLeft, RelativeSizeAxes = Axes.X,
Origin = Anchor.BottomLeft, AutoSizeAxes = Axes.Y,
Font = OsuFont.GetFont(size: 13),
Text = header Text = header
}, },
filter = CreateFilter() filter = CreateFilter()
@ -69,10 +66,8 @@ namespace osu.Game.Overlays.BeatmapListing
{ {
public BeatmapSearchFilter() public BeatmapSearchFilter()
{ {
Anchor = Anchor.BottomLeft;
Origin = Anchor.BottomLeft;
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;
Height = 15; AutoSizeAxes = Axes.Y;
TabContainer.Spacing = new Vector2(10, 0); TabContainer.Spacing = new Vector2(10, 0);
@ -83,33 +78,16 @@ namespace osu.Game.Overlays.BeatmapListing
} }
} }
[BackgroundDependencyLoader] protected override Dropdown<T> CreateDropdown() => null!;
private void load(OverlayColourProvider colourProvider)
{
if (Dropdown is FilterDropdown fd)
fd.AccentColour = colourProvider.Light2;
}
protected override Dropdown<T> CreateDropdown() => new FilterDropdown();
protected override TabItem<T> CreateTabItem(T value) => new FilterTabItem<T>(value); protected override TabItem<T> CreateTabItem(T value) => new FilterTabItem<T>(value);
private partial class FilterDropdown : OsuTabDropdown<T> protected override TabFillFlowContainer CreateTabFlow() => new TabFillFlowContainer
{ {
protected override DropdownHeader CreateHeader() => new FilterHeader RelativeSizeAxes = Axes.X,
{ AutoSizeAxes = Axes.Y,
Anchor = Anchor.TopRight, AllowMultiline = true,
Origin = Anchor.TopRight };
};
private partial class FilterHeader : OsuTabDropdownHeader
{
public FilterHeader()
{
Background.Height = 1;
}
}
}
} }
} }
} }

View File

@ -52,10 +52,8 @@ namespace osu.Game.Overlays.BeatmapListing
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
Anchor = Anchor.BottomLeft;
Origin = Anchor.BottomLeft;
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;
Height = 15; AutoSizeAxes = Axes.Y;
Spacing = new Vector2(10, 0); Spacing = new Vector2(10, 0);
AddRange(GetValues().Select(CreateTabItem)); AddRange(GetValues().Select(CreateTabItem));

View File

@ -33,8 +33,6 @@ namespace osu.Game.Overlays.BeatmapListing
private void load() private void load()
{ {
AutoSizeAxes = Axes.Both; AutoSizeAxes = Axes.Both;
Anchor = Anchor.BottomLeft;
Origin = Anchor.BottomLeft;
AddRangeInternal(new Drawable[] AddRangeInternal(new Drawable[]
{ {
text = new OsuSpriteText text = new OsuSpriteText