mirror of
https://github.com/ppy/osu
synced 2024-12-16 20:05:41 +00:00
parent
f76c6a47d2
commit
9b44f447ca
@ -207,6 +207,12 @@ namespace osu.Game.Tests.Visual
|
||||
checkVisibleItemCount(true, 0);
|
||||
AddAssert("Selection is null", () => currentSelection == null);
|
||||
|
||||
advanceSelection(true);
|
||||
AddAssert("Selection is null", () => currentSelection == null);
|
||||
|
||||
advanceSelection(false);
|
||||
AddAssert("Selection is null", () => currentSelection == null);
|
||||
|
||||
AddStep("Un-filter", () => carousel.Filter(new FilterCriteria(), false));
|
||||
|
||||
AddAssert("Selection is non-null", () => currentSelection != null);
|
||||
|
@ -192,7 +192,9 @@ namespace osu.Game.Screens.Select
|
||||
/// <param name="skipDifficulties">Whether to skip individual difficulties and only increment over full groups.</param>
|
||||
public void SelectNext(int direction = 1, bool skipDifficulties = true)
|
||||
{
|
||||
if (!Items.Any())
|
||||
var visibleItems = Items.Where(s => !s.Item.Filtered).ToList();
|
||||
|
||||
if (!visibleItems.Any())
|
||||
return;
|
||||
|
||||
DrawableCarouselItem drawable = null;
|
||||
@ -202,15 +204,15 @@ namespace osu.Game.Screens.Select
|
||||
// we can fix this by changing this method to not reference drawables / Items in the first place.
|
||||
return;
|
||||
|
||||
int originalIndex = Items.IndexOf(drawable);
|
||||
int originalIndex = visibleItems.IndexOf(drawable);
|
||||
int currentIndex = originalIndex;
|
||||
|
||||
// local function to increment the index in the required direction, wrapping over extremities.
|
||||
int incrementIndex() => currentIndex = (currentIndex + direction + Items.Count) % Items.Count;
|
||||
int incrementIndex() => currentIndex = (currentIndex + direction + visibleItems.Count) % visibleItems.Count;
|
||||
|
||||
while (incrementIndex() != originalIndex)
|
||||
{
|
||||
var item = Items[currentIndex].Item;
|
||||
var item = visibleItems[currentIndex].Item;
|
||||
|
||||
if (item.Filtered || item.State == CarouselItemState.Selected) continue;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user