Added VCENTER to lcd flags

Only for COLORLCD
This commit is contained in:
jfrickmann
2021-07-21 19:53:13 -04:00
parent d3c16a89c4
commit 2e129af9f1
3 changed files with 6 additions and 2 deletions
+4 -1
View File
@@ -47,7 +47,10 @@ static int8_t getTextVerticalOffset(LcdFlags flags)
if (font_index >= sizeof(text_vertical_offset)) { if (font_index >= sizeof(text_vertical_offset)) {
return 0; return 0;
} }
return text_vertical_offset[font_index]; int vcenter = 0;
if (flags & VCENTERED)
vcenter = 0.5 * getFontHeight(flags & 0xFFFF);
return text_vertical_offset[font_index] - vcenter;
} }
/*luadoc /*luadoc
+1
View File
@@ -1860,6 +1860,7 @@ const luaR_value_entry opentxConstants[] = {
#endif #endif
#if defined(COLORLCD) #if defined(COLORLCD)
{ "BOLD", FONT(BOLD) }, { "BOLD", FONT(BOLD) },
{ "VCENTER", VCENTERED },
#else #else
{ "BOLD", BOLD }, { "BOLD", BOLD },
#endif #endif
+1 -1
View File
@@ -360,7 +360,7 @@ void LuaWidget::background()
{ {
if (lsWidgets == 0 || errorMessage) return; if (lsWidgets == 0 || errorMessage) return;
TRACE("LuaWidget::background()"); // TRACE("LuaWidget::background()");
luaSetInstructionsLimit(lsWidgets, WIDGET_SCRIPTS_MAX_INSTRUCTIONS); luaSetInstructionsLimit(lsWidgets, WIDGET_SCRIPTS_MAX_INSTRUCTIONS);
LuaWidgetFactory * factory = (LuaWidgetFactory *)this->factory; LuaWidgetFactory * factory = (LuaWidgetFactory *)this->factory;
if (factory->backgroundFunction) { if (factory->backgroundFunction) {