Skip to content
Snippets Groups Projects
Commit d0e44c97 authored by Eric Oulashin's avatar Eric Oulashin
Browse files

DDLightbarMenu: Fix to enable wrap navigation again, and fixed a comment about titlebar text

parent a775092c
No related branches found
No related tags found
1 merge request!371DDLightbarMenu: Fix to enable wrap navigation again, and fixed a comment about titlebar text
Pipeline #4935 passed
...@@ -13,7 +13,7 @@ By default, this menu library does not display a border around the menu. ...@@ -13,7 +13,7 @@ By default, this menu library does not display a border around the menu.
If you want this library to draw a border around the menu, you can set the If you want this library to draw a border around the menu, you can set the
borderEnabled property to true. Without a border, the menu gains 2 borderEnabled property to true. Without a border, the menu gains 2
characters of width and 2 lines of height. If using a border, a title (text) characters of width and 2 lines of height. If using a border, a title (text)
can be displayed in the top border by setting the menuTitle property (it can be displayed in the top border by setting the topBorderText property (it
defaults to an empty string, for no title). defaults to an empty string, for no title).
This script provides an object, DDLightbarMenu. Use the DDLightbarMenu This script provides an object, DDLightbarMenu. Use the DDLightbarMenu
...@@ -2204,6 +2204,7 @@ function DDLightbarMenu_DoKeyUp(pSelectedItemIndexes, pNumItems) ...@@ -2204,6 +2204,7 @@ function DDLightbarMenu_DoKeyUp(pSelectedItemIndexes, pNumItems)
// last item. // last item.
// If there are unselectable items above the current one, then scroll the item list up before // If there are unselectable items above the current one, then scroll the item list up before
// wrapping down to the last selectable item // wrapping down to the last selectable item
/*
var canWrapNav = false; var canWrapNav = false;
if (this.allowUnselectableItems && this.selectedItemIdx > 0) if (this.allowUnselectableItems && this.selectedItemIdx > 0)
{ {
...@@ -2215,6 +2216,22 @@ function DDLightbarMenu_DoKeyUp(pSelectedItemIndexes, pNumItems) ...@@ -2215,6 +2216,22 @@ function DDLightbarMenu_DoKeyUp(pSelectedItemIndexes, pNumItems)
else else
canWrapNav = true; canWrapNav = true;
} }
*/
var canWrapNav = true;
if (this.allowUnselectableItems)
{
canWrapNav = false;
if (this.selectedItemIdx > 0)
{
if (this.topItemIdx > 0)
{
--this.topItemIdx;
this.Draw(selectedItemIndexes);
}
else
canWrapNav = true;
}
}
if (canWrapNav && this.wrapNavigation) if (canWrapNav && this.wrapNavigation)
{ {
// If there are more items than can fit on the menu, then ideally, the top // If there are more items than can fit on the menu, then ideally, the top
...@@ -2288,6 +2305,7 @@ function DDLightbarMenu_DoKeyDown(pSelectedItemIndexes, pNumItems) ...@@ -2288,6 +2305,7 @@ function DDLightbarMenu_DoKeyDown(pSelectedItemIndexes, pNumItems)
// then go to the first item. // then go to the first item.
// If there are unselectable items below the current one, then scroll the item down up before // If there are unselectable items below the current one, then scroll the item down up before
// wrapping up to the first selectable item // wrapping up to the first selectable item
/*
var canWrapNav = false; var canWrapNav = false;
if (this.allowUnselectableItems && this.selectedItemIdx > 0) if (this.allowUnselectableItems && this.selectedItemIdx > 0)
{ {
...@@ -2304,6 +2322,27 @@ function DDLightbarMenu_DoKeyDown(pSelectedItemIndexes, pNumItems) ...@@ -2304,6 +2322,27 @@ function DDLightbarMenu_DoKeyDown(pSelectedItemIndexes, pNumItems)
else else
canWrapNav = true; canWrapNav = true;
} }
*/
var canWrapNav = true;
if (this.allowUnselectableItems)
{
canWrapNav = false;
if (this.selectedItemIdx > 0)
{
var topIndexForLastPage = numItems - this.GetNumItemsPerPage();
if (topIndexForLastPage < 0)
topIndexForLastPage = 0;
else if (topIndexForLastPage >= numItems)
topIndexForLastPage = numItems - 1;
if (this.topItemIdx < topIndexForLastPage)
{
++this.topItemIdx;
this.Draw(selectedItemIndexes);
}
else
canWrapNav = true;
}
}
if (canWrapNav && this.wrapNavigation) if (canWrapNav && this.wrapNavigation)
{ {
// If there are more items than can fit on the menu, then ideally, the top // If there are more items than can fit on the menu, then ideally, the top
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment