Fixed BigValueDisplay

This commit is contained in:
2023-01-12 23:41:52 +01:00
parent c7bba7daa1
commit f673391ed3
3 changed files with 7 additions and 2 deletions

View File

@ -26,7 +26,11 @@ std::string richTextEscape(std::string_view subject)
int16_t renderRichText(TftInterface &tft, std::string_view str, int32_t poX, int32_t poY, uint16_t color, uint16_t bgcolor, uint8_t font)
{
FontRenderer fontRenderer{tft};
return renderRichText(tft, fontRenderer, str, poX, poY, color, bgcolor, font);
}
int16_t renderRichText(TftInterface &tft, FontRenderer &fontRenderer, std::string_view str, int32_t poX, int32_t poY, uint16_t color, uint16_t bgcolor, uint8_t font)
{
if (str.empty())
return 0;

View File

@ -5,7 +5,7 @@
#include <string>
// forward declares
namespace espgui { class TftInterface; }
namespace espgui { class TftInterface; class FontRenderer; }
namespace espgui {
@ -13,5 +13,6 @@ void richTextEscape(std::string &subject);
std::string richTextEscape(std::string_view subject);
int16_t renderRichText(TftInterface &tft, std::string_view str, int32_t poX, int32_t poY, uint16_t color, uint16_t bgcolor, uint8_t font);
int16_t renderRichText(TftInterface &tft, FontRenderer &fontRenderer, std::string_view str, int32_t poX, int32_t poY, uint16_t color, uint16_t bgcolor, uint8_t font);
} // namespace espgui

View File

@ -38,7 +38,7 @@ void Label::redraw(TftInterface &tft, FontRenderer &fontRenderer, std::string_vi
!forceRedraw)
return;
const auto renderedWidth = renderRichText(tft, str, m_x, m_y, color, bgcolor, font);
const auto renderedWidth = renderRichText(tft, fontRenderer, str, m_x, m_y, color, bgcolor, font);
const auto renderedHeight = fontRenderer.fontHeight(font);
if (renderedWidth < m_lastWidth)