feat: Switching sorting in Freeplay, if your currently selected song is in the next section, we move there immediately for easier navigation

This commit is contained in:
Cameron Taylor
2025-03-10 21:44:24 -04:00
committed by Eric
parent 7ab3818344
commit fb26aeb71a
+9 -2
View File
@@ -497,6 +497,8 @@ class FreeplayState extends MusicBeatSubState
// Reminder, this is a callback function being set, rather than these being called here in create()
letterSort.changeSelectionCallback = (str) -> {
var curSong:Null<FreeplaySongData> = grpCapsules.members[curSelected]?.freeplayData;
switch (str)
{
case 'fav':
@@ -509,9 +511,14 @@ class FreeplayState extends MusicBeatSubState
generateSongList({filterType: REGEXP, filterData: str}, true);
}
// We want to land on the first song of the group, rather than random song when changing letter sorts
// If the current song is still in the list (aka not null?), we'll land on it
// Otherwise we want to land on the first song of the group, rather than random song when changing letter sorts
// that is, only if there's more than one song in the group!
if (grpCapsules.members.length > 0)
if (curSong != null && currentFilteredSongs.length > 1)
{
changeSelection();
}
else if (grpCapsules.members.length > 0)
{
FunkinSound.playOnce(Paths.sound('scrollMenu'), 0.4);
curSelected = 1;