Skip to content

Commit e0415f1

Browse files
committed
Correct scroll length for left and up directions
Previously, the calculation for the distance of leftward and upward scrolling resulted in the text bitmap not being scrolled completely off the display. For leftward scrolling, this would be noticeable in the case where the bitmap of the last character in the string had populated pixels on the rightmost column. For upward scrolling, this would be noticeable in the case where the bitmap of any character in the string had populated pixels on the bottom row.
1 parent 589b622 commit e0415f1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/ArduinoGraphics.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ void ArduinoGraphics::endText(int scrollDirection)
452452
stroke(_textR, _textG, _textB);
453453

454454
if (scrollDirection == SCROLL_LEFT) {
455-
int scrollLength = _textBuffer.length() * textFontWidth() + _textX;
455+
int scrollLength = _textBuffer.length() * textFontWidth() + _textX + 1;
456456

457457
for (int i = 0; i < scrollLength; i++) {
458458
beginDraw();
@@ -476,7 +476,7 @@ void ArduinoGraphics::endText(int scrollDirection)
476476
delay(_textScrollSpeed);
477477
}
478478
} else if (scrollDirection == SCROLL_UP) {
479-
int scrollLength = textFontHeight() + _textY;
479+
int scrollLength = textFontHeight() + _textY + 1;
480480

481481
for (int i = 0; i < scrollLength; i++) {
482482
beginDraw();

0 commit comments

Comments
 (0)