We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents aab20a5 + 06ee9c1 commit 2aa4614Copy full SHA for 2aa4614
adafruit_qualia/displays/__init__.py
@@ -45,11 +45,11 @@ def transform(self, x, y):
45
if self._rotation == 0:
46
return x, y
47
elif self._rotation == 90:
48
- return y, self._height - x
+ return y, self._width - x
49
elif self._rotation == 180:
50
return self._width - x, self._height - y
51
elif self._rotation == 270:
52
- return self._width - y, x
+ return self._height - y, x
53
else:
54
raise ValueError("Rotation must be 0, 90, 180, or 270")
55
@@ -170,9 +170,10 @@ def rotation(self, value: int):
170
"""Set the display rotation"""
171
if value not in {0, 90, 180, 270}:
172
173
- self._touch.rotation = value
+ if self._touch:
174
+ self._touch.rotation = value
175
# Update the display rotation if already initialized
- if self.display is not None:
176
+ if self.display:
177
self.display.rotation = value
178
179
@property
adafruit_qualia/graphics.py
@@ -67,7 +67,7 @@ class Graphics(GraphicsBase):
67
:param auto_refresh: Set to False to disable auto refresh. Defaults to True.
68
:param default_bg: The path to your default background image file or a hex color.
69
Defaults to 0x000000.
70
- :param rotation: Default rotation is landscape (270) but can be 0, 90, 180 for portrait/rotated
+ :param rotation: Default rotation is portrait (0) but can be 90, 180, 270 for landscape/rotated
71
:param debug: Turn on debug print outs. Defaults to False.
72
73
"""
0 commit comments