Skip to content

Commit 42579f8

Browse files
committed
fix anchored position rounding issue
1 parent dc3dcd2 commit 42579f8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

adafruit_display_text/label.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ def anchored_position(self):
385385
if self._anchor_point is None:
386386
return None
387387
return (
388-
int(self.x + (self._anchor_point[0] * self._boundingbox[2] * self._scale)),
388+
int(self.x + round(self._anchor_point[0] * self._boundingbox[2] * self._scale)),
389389
int(
390390
self.y
391391
+ (self._anchor_point[1] * self._boundingbox[3] * self._scale)
@@ -399,7 +399,7 @@ def anchored_position(self, new_position):
399399
return # Note: anchor_point must be set before setting anchored_position
400400
new_x = int(
401401
new_position[0]
402-
- self._anchor_point[0] * (self._boundingbox[2] * self._scale)
402+
- round(self._anchor_point[0] * (self._boundingbox[2] * self._scale))
403403
)
404404
new_y = int(
405405
new_position[1]

0 commit comments

Comments
 (0)