mirror of
https://github.com/thooge/esp32-nmea2000-obp60.git
synced 2026-08-18 10:22:31 +02:00
Fix for drawTextCenter() for ST7796
This commit is contained in:
@@ -488,9 +488,10 @@ std::vector<String> wordwrap(String &line, uint16_t maxwidth) {
|
|||||||
// Draw centered text
|
// Draw centered text
|
||||||
void drawTextCenter(int16_t cx, int16_t cy, String text) {
|
void drawTextCenter(int16_t cx, int16_t cy, String text) {
|
||||||
#ifdef DISPLAY_ST7796
|
#ifdef DISPLAY_ST7796
|
||||||
|
uint16_t h = getdisplay().fontHeight();
|
||||||
auto oldDatum = getdisplay().getTextDatum();
|
auto oldDatum = getdisplay().getTextDatum();
|
||||||
getdisplay().setTextDatum(textdatum_t::middle_center);
|
getdisplay().setTextDatum(textdatum_t::top_center);
|
||||||
getdisplay().drawString(text, cx, cy);
|
getdisplay().drawString(text, cx, cy - static_cast<int16_t>(h / 2));
|
||||||
getdisplay().setTextDatum(oldDatum);
|
getdisplay().setTextDatum(oldDatum);
|
||||||
#else
|
#else
|
||||||
int16_t x1, y1;
|
int16_t x1, y1;
|
||||||
|
|||||||
Reference in New Issue
Block a user