-
-
Notifications
You must be signed in to change notification settings - Fork 2k
skip header items when enabling the InkHUD menu cursor #9552
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
dd48ebc
5b42c11
101a402
8b241fd
963ee02
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1524,7 +1524,15 @@ void InkHUD::MenuApplet::onButtonShortPress() | |
| if (!settings->joystick.enabled) { | ||
| if (!cursorShown) { | ||
| cursorShown = true; | ||
| // Select the first item that isn't a header | ||
| cursor = 0; | ||
| while (cursor < items.size() && items.at(cursor).isHeader) { | ||
| cursor++; | ||
| } | ||
| if (cursor >= items.size()) { | ||
| cursorShown = false; | ||
| cursor = 0; | ||
| } | ||
| } else { | ||
| do { | ||
| cursor = (cursor + 1) % items.size(); | ||
|
|
@@ -1576,7 +1584,15 @@ void InkHUD::MenuApplet::onNavUp() | |
|
|
||
| if (!cursorShown) { | ||
| 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; | ||
|
Comment on lines
+1587
to
+1592
|
||
| } | ||
| cursor--; | ||
| } | ||
| } else { | ||
| do { | ||
| if (cursor == 0) | ||
|
|
@@ -1597,7 +1613,15 @@ void InkHUD::MenuApplet::onNavDown() | |
|
|
||
| if (!cursorShown) { | ||
| cursorShown = true; | ||
| // Select the first item that isn't a header | ||
| cursor = 0; | ||
| while (cursor < items.size() && items.at(cursor).isHeader) { | ||
| cursor++; | ||
| } | ||
| if (cursor >= items.size()) { | ||
| cursorShown = false; | ||
| cursor = 0; | ||
| } | ||
| } else { | ||
| do { | ||
| cursor = (cursor + 1) % items.size(); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The “select first non-header item” logic is duplicated in both
onButtonShortPress()andonNavDown(). Consider extracting it into a small helper (and similarly for the “select last non-header” logic) to keep cursor-reveal behavior consistent and reduce the chance of future drift when header-handling changes.