Skip to content

Commit e60fb65

Browse files
author
Margaret Matocha
committed
Corrected calculation errors in anchored_position getter and setter
1 parent a1c4859 commit e60fb65

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

adafruit_display_text/label.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -259,11 +259,11 @@ def anchored_position(self):
259259
"""Position relative to the anchor_point. Tuple containing x,y
260260
pixel coordinates."""
261261
return (
262-
self.x - self._boundingbox[2] * self._anchor_point[0],
263-
self.y - self._boundingbox[3] * self._anchor_point[1],
262+
int(self.x + self._boundingbox[0] + self._anchor_point[0] * self._boundingbox[2]),
263+
int(self.y + self._boundingbox[1] + self._anchor_point[1] * self._boundingbox[3]),
264264
)
265265

266266
@anchored_position.setter
267267
def anchored_position(self, new_position):
268-
self.x = int(new_position[0] - (self._boundingbox[2] * self._anchor_point[0]))
269-
self.y = int(new_position[1] - (self._boundingbox[3] * self._anchor_point[1]))
268+
self.x = int(new_position[0] - self._boundingbox[0] - self._anchor_point[0] * self._boundingbox[2])
269+
self.y = int(new_position[1] - self._boundingbox[1] - self._anchor_point[1] * self._boundingbox[3])

0 commit comments

Comments
 (0)