Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrap beatmap listing filters and match web spacing #27541

Merged
merged 3 commits into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Wrap beatmap listing filters and match web spacing
  • Loading branch information
Joehuu committed Mar 8, 2024
commit db1c59475b0e31fd17d6944804c23a65b206c756
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ public BeatmapListingSearchControl()
RelativeSizeAxes = Axes.X,
Direction = FillDirection.Vertical,
Padding = new MarginPadding { Horizontal = 10 },
Spacing = new Vector2(5),
Children = new Drawable[]
{
generalFilter = new BeatmapSearchGeneralFilterRow(),
Expand Down
37 changes: 7 additions & 30 deletions osu.Game/Overlays/BeatmapListing/BeatmapSearchFilterRow.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
// 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.

using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.UserInterface;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
using osuTK;
using osu.Framework.Extensions.EnumExtensions;
using osu.Framework.Localisation;
Expand Down Expand Up @@ -49,8 +47,6 @@ public BeatmapSearchFilterRow(LocalisableString header)
{
new OsuSpriteText
{
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
Font = OsuFont.GetFont(size: 13),
Text = header
},
Expand All @@ -69,10 +65,8 @@ protected partial class BeatmapSearchFilter : TabControl<T>
{
public BeatmapSearchFilter()
{
Anchor = Anchor.BottomLeft;
Origin = Anchor.BottomLeft;
RelativeSizeAxes = Axes.X;
Height = 15;
AutoSizeAxes = Axes.Y;

TabContainer.Spacing = new Vector2(10, 0);

Expand All @@ -83,33 +77,16 @@ public BeatmapSearchFilter()
}
}

[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider)
{
if (Dropdown is FilterDropdown fd)
fd.AccentColour = colourProvider.Light2;
}

protected override Dropdown<T> CreateDropdown() => new FilterDropdown();
protected override Dropdown<T> CreateDropdown() => null!;

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
{
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight
};

private partial class FilterHeader : OsuTabDropdownHeader
{
public FilterHeader()
{
Background.Height = 1;
}
}
}
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
AllowMultiline = true,
};
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,8 @@ protected partial class MultipleSelectionFilter : FillFlowContainer<MultipleSele
[BackgroundDependencyLoader]
private void load()
{
Anchor = Anchor.BottomLeft;
Origin = Anchor.BottomLeft;
RelativeSizeAxes = Axes.X;
Height = 15;
AutoSizeAxes = Axes.Y;
Spacing = new Vector2(10, 0);

AddRange(GetValues().Select(CreateTabItem));
Expand Down
2 changes: 0 additions & 2 deletions osu.Game/Overlays/BeatmapListing/FilterTabItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ public FilterTabItem(T value)
private void load()
{
AutoSizeAxes = Axes.Both;
Anchor = Anchor.BottomLeft;
Origin = Anchor.BottomLeft;
AddRangeInternal(new Drawable[]
{
text = new OsuSpriteText
Expand Down
Loading