Merge pull request #32 from CommanderRedYT/bicycle

This commit is contained in:
Florian Wetzel
2025-04-10 12:19:44 +02:00
committed by GitHub
2 changed files with 8 additions and 4 deletions

View File

@ -4,4 +4,8 @@ config ESPGUI_MENUDISPLAY_ROWS
int "Number of rows for MenuDisplays"
default 10
config ESPGUI_MENUITEM_BACKGROUND_COLOR
hex "MenuItem background color"
default 0x5AEB
endmenu

View File

@ -149,7 +149,7 @@ void MenuDisplay::redraw(TftInterface &tft)
if (relativeIndex != m_highlightedIndex)
{
drawItemRect(*labelsIter, TFT_GREY);
drawItemRect(*labelsIter, CONFIG_ESPGUI_MENUITEM_BACKGROUND_COLOR);
*iconsIter = nullptr;
labelsIter->start(tft);
@ -166,20 +166,20 @@ void MenuDisplay::redraw(TftInterface &tft)
labelsIter->start(tft);
}
labelsIter->redraw(tft, item.text(), item.color(), selected ? TFT_GREY : TFT_BLACK, item.font());
labelsIter->redraw(tft, item.text(), item.color(), selected ? CONFIG_ESPGUI_MENUITEM_BACKGROUND_COLOR : TFT_BLACK, item.font());
if (const auto icon = item.icon(selected); icon != *iconsIter)
{
if (icon)
tft.pushImage(6, labelsIter->y() + 1, *icon);
else if (*iconsIter)
tft.fillRect(6, labelsIter->y() + 1, 24, 24, selected ? TFT_GREY : TFT_BLACK);
tft.fillRect(6, labelsIter->y() + 1, 24, 24, selected ? CONFIG_ESPGUI_MENUITEM_BACKGROUND_COLOR : TFT_BLACK);
*iconsIter = icon;
}
// if (selected && (relativeIndex != m_highlightedIndex))
// {
// drawItemRect(*labelsIter, TFT_GREY);
// drawItemRect(*labelsIter, CONFIG_ESPGUI_MENUITEM_BACKGROUND_COLOR);
// }
labelsIter++;