drawText(..., RIGHT) will now return the text left position

This commit is contained in:
Bertrand Songis
2020-01-03 17:28:36 +01:00
parent b9dbc710c7
commit e6850498f7
2 changed files with 6 additions and 3 deletions
+1 -1
View File
@@ -463,7 +463,7 @@ coord_t BitmapBuffer::drawSizedText(coord_t x, coord_t y, const char * s, uint8_
RESTORE_OFFSET();
return pos - offsetX;
return ((flags & RIGHT) ? orig_pos : pos) - offsetX;
}
coord_t BitmapBuffer::drawNumber(coord_t x, coord_t y, int32_t val, LcdFlags flags, uint8_t len, const char * prefix, const char * suffix)
+5 -2
View File
@@ -92,8 +92,8 @@ class Table: public Window {
public:
Table(Window * parent, const rect_t & rect, uint8_t columnsCount):
Window(parent, rect),
header(this, {0, 0, width(), TABLE_HEADER_HEIGHT}),
body(this, {0, TABLE_HEADER_HEIGHT, width(), height() - TABLE_HEADER_HEIGHT})
header(this, {0, 0, width(), 0}),
body(this, {0, 0, width(), height()})
{
setColumnsCount(columnsCount);
}
@@ -131,6 +131,9 @@ class Table: public Window {
void setHeader(const char * const values[])
{
header.setHeight(TABLE_HEADER_HEIGHT);
body.setTop(TABLE_HEADER_HEIGHT);
body.setHeight(height() - TABLE_HEADER_HEIGHT);
Line line;
for (uint8_t i = 0; i < count; i++) {
line.values.push_back(values[i]);