mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-08-03 10:46:12 +00:00
refactor(companion): extract drawRowSelection() for the canonical list-row bar
Every drawList/AccordionList row opened with the same hand-written display.drawSelectionRow(0, y-1, width-reserve, lineStep-1, sel) line — 14 copies of the same geometry and magic offsets. Add a drawRowSelection(d, y, sel, reserve) helper in icons.h next to drawList and route the canonical sites through it (Bot/LiveShare/Locator/Repeater/Settings/Tools/Nearby/ QuickMsg/Waypoints). Rows that intentionally differ (full-width DashboardConfig/QuickMsg, the keyboard/ringtone grids) keep their explicit drawSelectionRow() call — the helper is opt-in rather than baked into drawList, so legitimate variants aren't forced into one geometry. Framework doc updated to match. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
0e6bd743a6
commit
cc88e89a64
@@ -75,7 +75,7 @@ public:
|
||||
_acc.render(display,
|
||||
// Section header: "[+/-] <icon> Name"
|
||||
[&](int sec, int y, bool sel, int reserve, bool collapsed) {
|
||||
display.drawSelectionRow(0, y - 1, display.width() - reserve, display.lineStep() - 1, sel);
|
||||
drawRowSelection(display, y, sel, reserve);
|
||||
display.setCursor(2, y);
|
||||
display.print(collapsed ? "+" : "-");
|
||||
const int icon_x = 2 + cw + 2;
|
||||
@@ -85,7 +85,7 @@ public:
|
||||
},
|
||||
// Item: indented "<icon> Label"
|
||||
[&](int sec, int item, int y, bool sel, int reserve) {
|
||||
display.drawSelectionRow(0, y - 1, display.width() - reserve, display.lineStep() - 1, sel);
|
||||
drawRowSelection(display, y, sel, reserve);
|
||||
const int icon_x = 2 + cw + 2; // align item icons under the header icon
|
||||
// drawIcon(display, icon_x, y, SECTIONS[sec].tools[item].icon); // icons disabled for now, don't fit visually
|
||||
display.setCursor(icon_x + g, y);
|
||||
|
||||
Reference in New Issue
Block a user