From 7b99842708d33cd8406533108185156b943f44db Mon Sep 17 00:00:00 2001 From: Krzysztof Gutkowski Date: Thu, 26 Mar 2026 11:46:08 +0100 Subject: [PATCH] Adjust bad padding in `FilterControl` (#37098) Reported [on discord](https://discord.com/channels/188630481301012481/1097318920991559880/1462402881658294355). Not sure if this has been turned into an issue anywhere. Fixes awkward looking padding at the bottom of `FilterControl` by having `ScopedBeatmapSetDisplay` apply the top padding on its own instead of relying on the spacing of its parent fill flow. This way, the padding is animated away when the scoped display disappears, instead of remaining because the component is still technically there. | Before | After | |--------|--------| | image | image | [Screencast_20260325_114439.webm](https://github.com/user-attachments/assets/99bb7083-b2da-40a3-b5a0-d94476e7c1ac) I don't really like how `ScopedBeatmapSetDisplay` is now managing its own spacing in the parent container, but it's tightly tied to the filter control anyway so it's probably fine. --- .../FilterControl.ScopedBeatmapSetDisplay.cs | 3 + osu.Game/Screens/Select/FilterControl.cs | 147 ++++++++++-------- 2 files changed, 81 insertions(+), 69 deletions(-) diff --git a/osu.Game/Screens/Select/FilterControl.ScopedBeatmapSetDisplay.cs b/osu.Game/Screens/Select/FilterControl.ScopedBeatmapSetDisplay.cs index 040081605f..904d378fbd 100644 --- a/osu.Game/Screens/Select/FilterControl.ScopedBeatmapSetDisplay.cs +++ b/osu.Game/Screens/Select/FilterControl.ScopedBeatmapSetDisplay.cs @@ -107,7 +107,9 @@ namespace osu.Game.Screens.Select { if (ScopedBeatmapSet.Value != null) { + this.TransformTo(nameof(Margin), new MarginPadding { Top = 5 }, transition_duration, Easing.OutQuint); content.BypassAutoSizeAxes = Axes.None; + text.Clear(); text.AddText(SongSelectStrings.TemporarilyShowingAllBeatmapsIn); text.AddText(@" "); @@ -115,6 +117,7 @@ namespace osu.Game.Screens.Select } else { + this.TransformTo(nameof(Margin), new MarginPadding(0), transition_duration, Easing.OutQuint); flashLayer.FadeOutFromOne(transition_duration, Easing.OutQuint); content.BypassAutoSizeAxes = Axes.Y; } diff --git a/osu.Game/Screens/Select/FilterControl.cs b/osu.Game/Screens/Select/FilterControl.cs index 4867e7de8c..f297e3b2b0 100644 --- a/osu.Game/Screens/Select/FilterControl.cs +++ b/osu.Game/Screens/Select/FilterControl.cs @@ -109,99 +109,108 @@ namespace osu.Game.Screens.Select RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Direction = FillDirection.Vertical, - Spacing = new Vector2(0f, 5f), Padding = new MarginPadding { Top = corner_radius + 5, Bottom = 2, Right = 40f, Left = 2f }, Children = new Drawable[] { - new Container + new ReverseChildIDFillFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, - Shear = -OsuGame.SHEAR, - Child = searchTextBox = new SongSelectSearchTextBox + Direction = FillDirection.Vertical, + Spacing = new Vector2(0f, 5f), + Children = new Drawable[] { - RelativeSizeAxes = Axes.X, - HoldFocus = true, - ScopedBeatmapSet = { BindTarget = ScopedBeatmapSet }, - }, - }, - new GridContainer - { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Shear = -OsuGame.SHEAR, - RowDimensions = new[] { new Dimension(GridSizeMode.AutoSize) }, - ColumnDimensions = new[] - { - new Dimension(), - new Dimension(GridSizeMode.Absolute), // can probably be removed? - new Dimension(GridSizeMode.AutoSize), - }, - Content = new[] - { - new[] + new Container { - difficultyRangeSlider = new DifficultyRangeSlider + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Shear = -OsuGame.SHEAR, + Child = searchTextBox = new SongSelectSearchTextBox { RelativeSizeAxes = Axes.X, - MinRange = 0.1f, - }, - Empty(), - showConvertedBeatmapsButton = new ShearedToggleButton - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - AutoSizeAxes = Axes.X, - Text = UserInterfaceStrings.ShowConverts, - Height = 30f, + HoldFocus = true, + ScopedBeatmapSet = { BindTarget = ScopedBeatmapSet }, }, }, - } - }, - new GridContainer - { - RelativeSizeAxes = Axes.X, - Height = 30, - Shear = -OsuGame.SHEAR, - RowDimensions = new[] { new Dimension(GridSizeMode.AutoSize) }, - ColumnDimensions = new[] - { - new Dimension(maxSize: 180), - new Dimension(GridSizeMode.Absolute, 5), - new Dimension(maxSize: 180), - new Dimension(GridSizeMode.Absolute, 5), - new Dimension(), - new Dimension(GridSizeMode.AutoSize), - }, - Content = new[] - { - new[] + new GridContainer { - sortDropdown = new ShearedDropdown(SongSelectStrings.Sort) + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Shear = -OsuGame.SHEAR, + RowDimensions = new[] { new Dimension(GridSizeMode.AutoSize) }, + ColumnDimensions = new[] { - RelativeSizeAxes = Axes.X, - Items = Enum.GetValues(), + new Dimension(), + new Dimension(GridSizeMode.Absolute), // can probably be removed? + new Dimension(GridSizeMode.AutoSize), }, - Empty(), - groupDropdown = new ShearedDropdown(SongSelectStrings.Group) + Content = new[] { - RelativeSizeAxes = Axes.X, - Items = Enum.GetValues(), - }, - Empty(), - collectionDropdown = new CollectionDropdown + new[] + { + difficultyRangeSlider = new DifficultyRangeSlider + { + RelativeSizeAxes = Axes.X, + MinRange = 0.1f, + }, + Empty(), + showConvertedBeatmapsButton = new ShearedToggleButton + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + AutoSizeAxes = Axes.X, + Text = UserInterfaceStrings.ShowConverts, + Height = 30f, + }, + }, + } + }, + new GridContainer + { + RelativeSizeAxes = Axes.X, + Height = 30, + Shear = -OsuGame.SHEAR, + RowDimensions = new[] { new Dimension(GridSizeMode.AutoSize) }, + ColumnDimensions = new[] { - RelativeSizeAxes = Axes.X, + new Dimension(maxSize: 180), + new Dimension(GridSizeMode.Absolute, 5), + new Dimension(maxSize: 180), + new Dimension(GridSizeMode.Absolute, 5), + new Dimension(), + new Dimension(GridSizeMode.AutoSize), }, - } - } + Content = new[] + { + new[] + { + sortDropdown = new ShearedDropdown(SongSelectStrings.Sort) + { + RelativeSizeAxes = Axes.X, + Items = Enum.GetValues(), + }, + Empty(), + groupDropdown = new ShearedDropdown(SongSelectStrings.Group) + { + RelativeSizeAxes = Axes.X, + Items = Enum.GetValues(), + }, + Empty(), + collectionDropdown = new CollectionDropdown + { + RelativeSizeAxes = Axes.X, + }, + } + } + }, + }, }, new ScopedBeatmapSetDisplay { ScopedBeatmapSet = { BindTarget = ScopedBeatmapSet }, } }, - } + }, }; localUser = api.LocalUser.GetBoundCopy();