mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 00:40:09 +09:00
Add tests for (and fix) removal of last item in carousel
This commit is contained in:
@ -24,5 +24,22 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
protected override void ItemStateChanged(CarouselItem item, CarouselItemState value)
|
||||
{
|
||||
base.ItemStateChanged(item, value);
|
||||
|
||||
if (value == CarouselItemState.NotSelected)
|
||||
{
|
||||
if (Children.All(i => i.State != CarouselItemState.Selected))
|
||||
{
|
||||
var first = Children.FirstOrDefault(i => !i.Filtered);
|
||||
if (first != null)
|
||||
{
|
||||
first.State.Value = CarouselItemState.Selected;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user