Skip to content
Snippets Groups Projects
Commit afe93ae1 authored by nightfox's avatar nightfox
Browse files

Bug fix: Updated GetTopItemIdxToTopOfLastPage() and...

Bug fix: Updated GetTopItemIdxToTopOfLastPage() and SetTopItemIdxToTopOfLastPage() to return/set the top item index to 0 if there is only one page of menu items
parent 3013dcf2
No related branches found
No related tags found
No related merge requests found
......@@ -1131,7 +1131,10 @@ function DDLightbarMenu_GetTopItemIdxToTopOfLastPage()
var numItemsPerPage = this.size.height;
if (this.borderEnabled)
numItemsPerPage -= 2;
return this.items.length - numItemsPerPage;
var topItemIndex = this.items.length - numItemsPerPage;
if (topItemIndex < 0)
topItemIndex = 0;
return topItemIndex;
}
// Sets the top item index to the top item of the last page of items
......@@ -1141,6 +1144,8 @@ function DDLightbarMenu_SetTopItemIdxToTopOfLastPage()
if (this.borderEnabled)
numItemsPerPage -= 2;
this.topItemIdx = this.items.length - numItemsPerPage;
if (this.topItemIdx < 0)
this.topItemIdx = 0;
}
// Inputs a keypress from the user and handles some ESC-based
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment