Corrected calculation errors in anchored_position getter and setter

This commit is contained in:
Margaret Matocha 2020-05-22 22:13:43 -05:00
parent a1c4859ca7
commit e60fb65c70

View file

@ -259,11 +259,11 @@ class Label(displayio.Group):
"""Position relative to the anchor_point. Tuple containing x,y
pixel coordinates."""
return (
self.x - self._boundingbox[2] * self._anchor_point[0],
self.y - self._boundingbox[3] * self._anchor_point[1],
int(self.x + self._boundingbox[0] + self._anchor_point[0] * self._boundingbox[2]),
int(self.y + self._boundingbox[1] + self._anchor_point[1] * self._boundingbox[3]),
)
@anchored_position.setter
def anchored_position(self, new_position):
self.x = int(new_position[0] - (self._boundingbox[2] * self._anchor_point[0]))
self.y = int(new_position[1] - (self._boundingbox[3] * self._anchor_point[1]))
self.x = int(new_position[0] - self._boundingbox[0] - self._anchor_point[0] * self._boundingbox[2])
self.y = int(new_position[1] - self._boundingbox[1] - self._anchor_point[1] * self._boundingbox[3])