Skip to content

Commit

Permalink
Fix menu overflow scroll controls.
Browse files Browse the repository at this point in the history
  • Loading branch information
TomGrobbe committed Apr 9, 2019
1 parent 05f545f commit b54fd7f
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions MenuAPI/Menu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -699,10 +699,14 @@ public void GoUp()
oldItem = MenuItems[CurrentIndex];
}

CurrentIndex--; if (CurrentIndex < 0)
if (CurrentIndex == 0)
{
CurrentIndex = Size - 1;
}
else
{
CurrentIndex--;
}

var currItem = GetCurrentMenuItem();

Expand Down Expand Up @@ -738,11 +742,15 @@ public void GoDown()
oldItem = MenuItems[CurrentIndex];
}

CurrentIndex++;
if (CurrentIndex >= Size)
if (CurrentIndex > 0 && CurrentIndex >= Size - 1)
{
CurrentIndex = 0;
}
else
{
CurrentIndex++;
}

var currItem = GetCurrentMenuItem();
if (currItem == null || !VisibleMenuItems.Contains(currItem))
{
Expand Down

0 comments on commit b54fd7f

Please sign in to comment.