mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-08-04 03:06:12 +00:00
refactor(ui): shared drawList + header + key-decode helpers
- drawList(): scrollable list skeleton (visible window, keep-sel-in-view, scroll-column reserve, per-row callback, indicator). Migrate Tools, Bot, Nearby, Waypoints list and the three QuickMsg lists onto it; centralises the scroll-clamp/reserve/indicator that each had open-coded (and inconsistently). - drawCenteredHeader(): centred title + separator, replacing the duplicated two-liner across ~10 screens (incl. QuickMsg, which used width()/2 spacing and was missed before); unifies the separator at headerH()-sepH(). - keyIsPrev()/keyIsNext() in UIScreen.h for the LEFT||PREV / RIGHT||NEXT idiom; applied to 6 screens, behaviour-preserving. Cancel/context-menu stay per-screen (they mean different things on different screens). - rotLabel() dedups the 0/90/180/270 array in Settings. - Unify selection-row height to lineStep()-1 (Tools/Bot matched the rest). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -30,8 +30,7 @@ public:
|
||||
int bar_h = display.lineStep();
|
||||
int tip_y = bar_y + bar_h + 4;
|
||||
|
||||
display.drawTextCentered(display.width() / 2, 0, "AUTO-ADVERT");
|
||||
display.fillRect(0, display.headerH() - 1, display.width(), display.sepH());
|
||||
display.drawCenteredHeader("AUTO-ADVERT");
|
||||
|
||||
display.setCursor(2, label_y);
|
||||
display.print("Interval:");
|
||||
@@ -56,8 +55,8 @@ public:
|
||||
_task->gotoToolsScreen();
|
||||
return true;
|
||||
}
|
||||
bool right = (c == KEY_RIGHT || c == KEY_NEXT || c == KEY_ENTER);
|
||||
bool left = (c == KEY_LEFT || c == KEY_PREV);
|
||||
bool right = keyIsNext(c) || c == KEY_ENTER;
|
||||
bool left = keyIsPrev(c);
|
||||
if (right || left) {
|
||||
int idx = currentIdx();
|
||||
idx = right ? (idx + 1) % OPT_COUNT : (idx + OPT_COUNT - 1) % OPT_COUNT;
|
||||
|
||||
Reference in New Issue
Block a user