Scroll the new selected song to the middle of the screen
Updated _UpdateList() to scroll the song list, that the new selected song is in the middle of the screen.
This commit is contained in:
1 parent
fcf212df12
commit
a1e43aa1ce
1 file changed
+17
-2
@@ -592,13 +592,28 @@ namespace VocaluxeLib.Menu.SongMenu
|
|||||||
|
|
||||||
private void _UpdateList(bool force = false)
|
private void _UpdateList(bool force = false)
|
||||||
{
|
{
|
||||||
|
bool isInCategory = CBase.Songs.IsInCategory();
|
||||||
|
int itemCount = isInCategory ? CBase.Songs.GetNumSongsVisible() : CBase.Songs.GetNumCategories();
|
||||||
|
int halfListLength = _ListLength / 2;
|
||||||
int offset;
|
int offset;
|
||||||
|
|
||||||
if (_SelectionNr < _Offset && _SelectionNr >= 0)
|
if (_SelectionNr < _Offset && _SelectionNr >= 0)
|
||||||
offset = _SelectionNr;
|
{
|
||||||
|
if (_SelectionNr - halfListLength >= 0)
|
||||||
|
offset = _SelectionNr - halfListLength;
|
||||||
|
else
|
||||||
|
offset = 0;
|
||||||
|
}
|
||||||
else if (_SelectionNr >= _Offset + _ListLength)
|
else if (_SelectionNr >= _Offset + _ListLength)
|
||||||
offset = _SelectionNr - _ListLength + 1;
|
{
|
||||||
|
if (_SelectionNr + halfListLength > itemCount)
|
||||||
|
offset = itemCount - _ListLength;
|
||||||
|
else
|
||||||
|
offset = _SelectionNr - halfListLength;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
offset = _Offset;
|
offset = _Offset;
|
||||||
|
|
||||||
_UpdateList(offset, force);
|
_UpdateList(offset, force);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user