From e0415f19cf540edd901bce76ba37f52e54440898 Mon Sep 17 00:00:00 2001 From: per1234 Date: Tue, 11 Feb 2025 21:50:42 -0800 Subject: [PATCH] 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. --- src/ArduinoGraphics.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ArduinoGraphics.cpp b/src/ArduinoGraphics.cpp index 852c273..eef26da 100644 --- a/src/ArduinoGraphics.cpp +++ b/src/ArduinoGraphics.cpp @@ -452,7 +452,7 @@ void ArduinoGraphics::endText(int scrollDirection) stroke(_textR, _textG, _textB); if (scrollDirection == SCROLL_LEFT) { - int scrollLength = _textBuffer.length() * textFontWidth() + _textX; + int scrollLength = _textBuffer.length() * textFontWidth() + _textX + 1; for (int i = 0; i < scrollLength; i++) { beginDraw(); @@ -476,7 +476,7 @@ void ArduinoGraphics::endText(int scrollDirection) delay(_textScrollSpeed); } } else if (scrollDirection == SCROLL_UP) { - int scrollLength = textFontHeight() + _textY; + int scrollLength = textFontHeight() + _textY + 1; for (int i = 0; i < scrollLength; i++) { beginDraw();