refactor(display): extract dashboard tile grid logic to DisplayManager
This commit is contained in:
@@ -96,6 +96,22 @@ int DisplayDriverGFX::dashboardTouch(int x, int y) {
|
||||
return row * cols + col;
|
||||
}
|
||||
|
||||
void DisplayDriverGFX::drawTileAt(int x, int y, int w, int h, const char* label, uint16_t bgColor) {
|
||||
// Tile background (use fillRect - LovyanGFX may not have fillRoundRect)
|
||||
_gfx->fillRect(x, y, w, h, bgColor);
|
||||
|
||||
// Tile border
|
||||
_gfx->drawRect(x, y, w, h, 0xFFFF);
|
||||
|
||||
// Tile label
|
||||
_gfx->setTextColor(0xFFFF);
|
||||
_gfx->setTextSize(2);
|
||||
int textLen = strlen(label);
|
||||
int textW = textLen * 12;
|
||||
_gfx->setCursor(x + w/2 - textW/2, y + h/2 - 10);
|
||||
_gfx->print(label);
|
||||
}
|
||||
|
||||
HoldState DisplayDriverGFX::updateHold(unsigned long holdMs) {
|
||||
HoldState state;
|
||||
|
||||
|
||||
@@ -12,13 +12,15 @@ public:
|
||||
void render(const ScreenState& state) override;
|
||||
|
||||
TouchEvent readTouch() override;
|
||||
int dashboardTouch(int x, int y) override;
|
||||
HoldState updateHold(unsigned long holdMs) override;
|
||||
void updateHint(int x, int y, bool active) override;
|
||||
|
||||
int width() override;
|
||||
int height() override;
|
||||
|
||||
// Dashboard tiles - library handles grid math, we just draw
|
||||
void drawTileAt(int x, int y, int w, int h, const char* label, uint16_t bgColor) override;
|
||||
|
||||
// ── Internal ──
|
||||
static DisplayDriverGFX& instance();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user