Skip to content

Commit 9fa5c3f

Browse files
committed
Adjust labels rotation
1 parent c779724 commit 9fa5c3f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

modules/draw/TPiePainter.mjs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,12 @@ class TPiePainter extends ObjectPainter {
246246
}
247247
} else if (this.#lblor === 2) {
248248
// in the slice
249-
arg.align = 23;
250-
arg.rotate = Math.atan2(arg.y, arg.x) / Math.PI * 180 + 90;
249+
arg.rotate = Math.atan2(y2 - y1, x2 - x1) / Math.PI * 180;
250+
if ((arg.rotate > 90) || (arg.rotate < -90)) {
251+
arg.rotate += 180;
252+
arg.align = 21;
253+
} else
254+
arg.align = 23;
251255
} else if ((arg.x >= 0) && (arg.y >= 0)) {
252256
arg.align = 13;
253257
if (this.#is3d)

0 commit comments

Comments
 (0)