Merge pull request #18603 from peppy/fix-import-dialog

Add placeholder when no results are visible at song select
This commit is contained in:
Dan Balasescu
2022-06-08 15:22:31 +09:00
committed by GitHub
6 changed files with 197 additions and 62 deletions

View File

@ -98,6 +98,8 @@ namespace osu.Game.Screens.Select
protected readonly CarouselScrollContainer Scroll;
private readonly NoResultsPlaceholder noResultsPlaceholder;
private IEnumerable<CarouselBeatmapSet> beatmapSets => root.Children.OfType<CarouselBeatmapSet>();
// todo: only used for testing, maybe remove.
@ -171,7 +173,8 @@ namespace osu.Game.Screens.Select
Scroll = new CarouselScrollContainer
{
RelativeSizeAxes = Axes.Both,
}
},
noResultsPlaceholder = new NoResultsPlaceholder()
}
};
}
@ -649,8 +652,18 @@ namespace osu.Game.Screens.Select
// First we iterate over all non-filtered carousel items and populate their
// vertical position data.
if (revalidateItems)
{
updateYPositions();
if (visibleItems.Count == 0)
{
noResultsPlaceholder.Filter = activeCriteria;
noResultsPlaceholder.Show();
}
else
noResultsPlaceholder.Hide();
}
// if there is a pending scroll action we apply it without animation and transfer the difference in position to the panels.
// this is intentionally applied before updating the visible range below, to avoid animating new items (sourced from pool) from locations off-screen, as it looks bad.
if (pendingScrollOperation != PendingScrollOperation.None)