Skip to content

Commit 56ea562

Browse files
committed
[REFINE] improve readability of rotation check and enhance text rendering for arbitrary angles
1 parent 2657d88 commit 56ea562

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

qwt/scale_draw.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1049,11 +1049,11 @@ def drawLabel(self, painter, value):
10491049
# Check if rotation is a multiple of 90 degrees (within tolerance)
10501050
normalized_rotation = rotation % 360
10511051
is_90_degree_multiple = (
1052-
abs(normalized_rotation) < 1e-6 or
1053-
abs(normalized_rotation - 90) < 1e-6 or
1054-
abs(normalized_rotation - 180) < 1e-6 or
1055-
abs(normalized_rotation - 270) < 1e-6 or
1056-
abs(normalized_rotation - 360) < 1e-6
1052+
abs(normalized_rotation) < 1e-6
1053+
or abs(normalized_rotation - 90) < 1e-6
1054+
or abs(normalized_rotation - 180) < 1e-6
1055+
or abs(normalized_rotation - 270) < 1e-6
1056+
or abs(normalized_rotation - 360) < 1e-6
10571057
)
10581058

10591059
if is_90_degree_multiple:
@@ -1066,7 +1066,9 @@ def drawLabel(self, painter, value):
10661066
painter.restore()
10671067
else:
10681068
# Use pixmap-based rendering for arbitrary angles (aligned but slightly blurry)
1069-
self._drawRotatedTextWithAlignment(painter, lbl, pos, labelSize, rotation)
1069+
self._drawRotatedTextWithAlignment(
1070+
painter, lbl, pos, labelSize, rotation
1071+
)
10701072
else:
10711073
# Use standard approach for non-rotated text
10721074
transform = self.labelTransformation(pos, labelSize)

0 commit comments

Comments
 (0)