Skip to content

Commit 9cf2f27

Browse files
committed
Fix for bitmap_label losing direction bug 169
1 parent 5c8bc08 commit 9cf2f27

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

adafruit_display_text/bitmap_label.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -547,9 +547,12 @@ def _set_background_color(self, new_color: Optional[int]):
547547
self._palette.make_transparent(0)
548548

549549
def _set_label_direction(self, new_label_direction: str) -> None:
550-
self._prev_label_direction = self._label_direction
551-
self._label_direction = new_label_direction
552-
self._reset_text(text=str(self._text)) # Force a recalculation
550+
# Only make changes if new direction is different
551+
# to prevent errors in the _reset_text() direction checks
552+
if self._label_direction != new_label_direction:
553+
self._prev_label_direction = self._label_direction
554+
self._label_direction = new_label_direction
555+
self._reset_text(text=str(self._text)) # Force a recalculation
553556

554557
def _get_valid_label_directions(self) -> Tuple[str, ...]:
555558
return "LTR", "RTL", "UPD", "UPR", "DWR"

0 commit comments

Comments
 (0)