Skip to content

Commit f1816eb

Browse files
authored
Merge pull request #1044 from Flamenco/hotfix_arc_angle_calculation
Fix regression in angle calculation
2 parents e0d0645 + 7004b03 commit f1816eb

File tree

1 file changed

+6
-20
lines changed

1 file changed

+6
-20
lines changed

plugins/context2d.js

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1544,28 +1544,14 @@
15441544
if (startAngleN < 0) {
15451545
startAngleN = twoPI + startAngleN;
15461546
}
1547-
var endAngleN = endAngle;
1548-
if (endAngleN < twoPI || endAngleN > twoPI) {
1549-
endAngleN = endAngleN % twoPI;
1547+
1548+
while (startAngle > endAngle) {
1549+
startAngle = startAngle - twoPI;
15501550
}
1551-
if (endAngleN < 0) {
1552-
endAngleN = twoPI + endAngleN;
1553-
}
1554-
1555-
// Total arc angle is less than or equal to 2PI.
1556-
var totalAngle = Math.abs(endAngleN - startAngleN);
1551+
var totalAngle = Math.abs(endAngle - startAngle);
15571552
if (totalAngle < twoPI) {
1558-
if (totalAngle < twoPI) {
1559-
if (anticlockwise) {
1560-
if (startAngle < endAngle) {
1561-
totalAngle = twoPI - totalAngle;
1562-
}
1563-
}
1564-
else {
1565-
if (startAngle > endAngle) {
1566-
totalAngle = twoPI - totalAngle;
1567-
}
1568-
}
1553+
if (anticlockwise) {
1554+
totalAngle = twoPI - totalAngle;
15691555
}
15701556
}
15711557

0 commit comments

Comments
 (0)