Skip to content

Commit d4dd7c8

Browse files
committed
Convert label coordinates to integers for consistency in canvas positioning
1 parent d2b88dd commit d4dd7c8

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

plotpy/items/label.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,8 +452,12 @@ def move_local_shape(self, old_pos: QPointF, new_pos: QPointF) -> None:
452452
lx, ly = self.C
453453
lx += new_pos.x() - old_pos.x()
454454
ly += new_pos.y() - old_pos.y()
455+
lx, ly = (
456+
int(lx),
457+
int(ly),
458+
) # Convert to integer (expected type for canvas coordinates)
455459
self.C = lx, ly
456-
self.labelparam.xc, self.labelparam.yc = int(lx), int(ly)
460+
self.labelparam.xc, self.labelparam.yc = lx, ly
457461
lx0, ly0 = canvas_to_axes(self, old_pos)
458462
lx1, ly1 = canvas_to_axes(self, new_pos)
459463
else:

0 commit comments

Comments
 (0)