Improve text alignment
This commit is contained in:
parent
557df68c75
commit
fc2a7ce42f
|
|
@ -7,5 +7,12 @@
|
||||||
"path": "firmware"
|
"path": "firmware"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"settings": {}
|
"settings": {
|
||||||
|
"files.associations": {
|
||||||
|
"*.ejs": "html",
|
||||||
|
".env": "env",
|
||||||
|
".env.*": "env",
|
||||||
|
"cmath": "cpp"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -26,6 +26,8 @@ void dow_get_text_item_rect(GxEPD2_BW<GxEPD2_583_GDEQ0583T31, GxEPD2_583_GDEQ058
|
||||||
dow_apply_font(display, item->font);
|
dow_apply_font(display, item->font);
|
||||||
display.getTextBounds(item->contents, 0, 0, &tbx, &tby, &tbw, &tbh);
|
display.getTextBounds(item->contents, 0, 0, &tbx, &tby, &tbw, &tbh);
|
||||||
|
|
||||||
|
// bool debug = item->contents.equals("Srazky");
|
||||||
|
|
||||||
int x = item->x;
|
int x = item->x;
|
||||||
int y = item->y;
|
int y = item->y;
|
||||||
int w = tbw;
|
int w = tbw;
|
||||||
|
|
@ -50,14 +52,14 @@ void dow_get_text_item_rect(GxEPD2_BW<GxEPD2_583_GDEQ0583T31, GxEPD2_583_GDEQ058
|
||||||
{
|
{
|
||||||
case ITEM_ALIGN_CENTER:
|
case ITEM_ALIGN_CENTER:
|
||||||
{
|
{
|
||||||
y += tby;
|
y -= (h + tby);
|
||||||
y += round((double)h / 2);
|
y += round((double)h / 2);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case ITEM_ALIGN_START:
|
case ITEM_ALIGN_START:
|
||||||
{
|
{
|
||||||
y += tby;
|
y -= (h + tby);
|
||||||
y += h;
|
y += h;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -79,6 +81,27 @@ void dow_get_text_item_rect(GxEPD2_BW<GxEPD2_583_GDEQ0583T31, GxEPD2_583_GDEQ058
|
||||||
*ry = y;
|
*ry = y;
|
||||||
*rw = w;
|
*rw = w;
|
||||||
*rh = h;
|
*rh = h;
|
||||||
|
|
||||||
|
/*
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Serial.print(x);
|
||||||
|
Serial.print(", ");
|
||||||
|
Serial.print(y);
|
||||||
|
Serial.print(", ");
|
||||||
|
Serial.print(w);
|
||||||
|
Serial.print(", ");
|
||||||
|
Serial.print(h);
|
||||||
|
Serial.print(", tbx:");
|
||||||
|
Serial.print(tbx);
|
||||||
|
Serial.print(", tby:");
|
||||||
|
Serial.print(tby);
|
||||||
|
Serial.print(", tbw:");
|
||||||
|
Serial.print(tbw);
|
||||||
|
Serial.print(", tbh:");
|
||||||
|
Serial.println(tbh);
|
||||||
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void dow_get_item_rect(GxEPD2_BW<GxEPD2_583_GDEQ0583T31, GxEPD2_583_GDEQ0583T31::HEIGHT> &display, dow_item_t *item, int *rx, int *ry, int *rw, int *rh)
|
void dow_get_item_rect(GxEPD2_BW<GxEPD2_583_GDEQ0583T31, GxEPD2_583_GDEQ0583T31::HEIGHT> &display, dow_item_t *item, int *rx, int *ry, int *rw, int *rh)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue