Fix bug #122 by different approach

This commit is contained in:
Bodmer 2018-04-12 18:48:01 +01:00
parent 3945a9776d
commit 4d181d7a19
2 changed files with 6 additions and 6 deletions

View File

@ -4115,9 +4115,9 @@ int16_t TFT_eSPI::drawString(const char *string, int poX, int poY, int font)
}
// Check coordinates are OK, adjust if not
if (poX < 0) poX = 0;
if (poX+cwidth>_width) poX = _width - cwidth;
if (poX+cwidth > width()) poX = width() - cwidth;
if (poY < 0) poY = 0;
if (poY+cheight-baseline>_height) poY = _height - cheight;
if (poY+cheight-baseline> height()) poY = height() - cheight;
}

View File

@ -471,7 +471,9 @@ class TFT_eSPI : public Print {
fillRect(int32_t x, int32_t y, int32_t w, int32_t h, uint32_t color);
virtual int16_t drawChar(unsigned int uniCode, int x, int y, int font),
drawChar(unsigned int uniCode, int x, int y);
drawChar(unsigned int uniCode, int x, int y),
height(void),
width(void);
// The TFT_eSprite class inherits the following functions
void setWindow(int16_t x0, int16_t y0, int16_t x1, int16_t y1),
@ -588,9 +590,7 @@ class TFT_eSPI : public Print {
drawCentreString(const String& string, int dX, int poY, int font), // Deprecated, use setTextDatum() and drawString()
drawRightString(const String& string, int dX, int poY, int font); // Deprecated, use setTextDatum() and drawString()
int16_t height(void),
width(void),
textWidth(const char *string, int font),
int16_t textWidth(const char *string, int font),
textWidth(const char *string),
textWidth(const String& string, int font),
textWidth(const String& string),