skip header items when enabling the InkHUD menu cursor (#9552)
* onNavUp() sets the menu cursor to the last item if not shown * skip headers when showing the menu cursor in onNavUp() and onNavDown() * skip headers when showing the menu cursor in onButtonShortPress() * brace cursor incrementing --------- Co-authored-by: Ben Meadors <benmmeadors@gmail.com> Co-authored-by: HarukiToreda <116696711+HarukiToreda@users.noreply.github.com>
This commit is contained in:
co-authored by
Ben Meadors
HarukiToreda
parent
86986d6337
commit
840b29860f
@@ -1524,7 +1524,15 @@ void InkHUD::MenuApplet::onButtonShortPress()
|
|||||||
if (!settings->joystick.enabled) {
|
if (!settings->joystick.enabled) {
|
||||||
if (!cursorShown) {
|
if (!cursorShown) {
|
||||||
cursorShown = true;
|
cursorShown = true;
|
||||||
|
// Select the first item that isn't a header
|
||||||
cursor = 0;
|
cursor = 0;
|
||||||
|
while (cursor < items.size() && items.at(cursor).isHeader) {
|
||||||
|
cursor++;
|
||||||
|
}
|
||||||
|
if (cursor >= items.size()) {
|
||||||
|
cursorShown = false;
|
||||||
|
cursor = 0;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
do {
|
do {
|
||||||
cursor = (cursor + 1) % items.size();
|
cursor = (cursor + 1) % items.size();
|
||||||
@@ -1576,7 +1584,15 @@ void InkHUD::MenuApplet::onNavUp()
|
|||||||
|
|
||||||
if (!cursorShown) {
|
if (!cursorShown) {
|
||||||
cursorShown = true;
|
cursorShown = true;
|
||||||
cursor = 0;
|
// Select the last item that isn't a header
|
||||||
|
cursor = items.size() - 1;
|
||||||
|
while (items.at(cursor).isHeader) {
|
||||||
|
if (cursor == 0) {
|
||||||
|
cursorShown = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
cursor--;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
do {
|
do {
|
||||||
if (cursor == 0)
|
if (cursor == 0)
|
||||||
@@ -1597,7 +1613,15 @@ void InkHUD::MenuApplet::onNavDown()
|
|||||||
|
|
||||||
if (!cursorShown) {
|
if (!cursorShown) {
|
||||||
cursorShown = true;
|
cursorShown = true;
|
||||||
|
// Select the first item that isn't a header
|
||||||
cursor = 0;
|
cursor = 0;
|
||||||
|
while (cursor < items.size() && items.at(cursor).isHeader) {
|
||||||
|
cursor++;
|
||||||
|
}
|
||||||
|
if (cursor >= items.size()) {
|
||||||
|
cursorShown = false;
|
||||||
|
cursor = 0;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
do {
|
do {
|
||||||
cursor = (cursor + 1) % items.size();
|
cursor = (cursor + 1) % items.size();
|
||||||
|
|||||||
Reference in New Issue
Block a user