Skip to content

Commit aa6d492

Browse files
committed
Use the radians representation of prevAngle only for comparison (to fix failing tests due to floating point imprecision)
1 parent 896c247 commit aa6d492

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/plots/cartesian/axes.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -3804,13 +3804,14 @@ axes.drawLabels = function(gd, ax, opts) {
38043804
);
38053805
}
38063806
}
3807+
var angleDegrees = angleRadians * (180 / Math.PI /* to degrees */);
38073808
if(prevAngle !== undefined) {
38083809
var prevAngleRadians = prevAngle * Math.PI / 180;
3809-
angleRadians = Math.abs(Math.cos(angleRadians)) < Math.abs(Math.cos(prevAngleRadians)) ? angleRadians : prevAngleRadians;
3810+
angleDegrees = Math.abs(Math.cos(angleRadians)) < Math.abs(Math.cos(prevAngleRadians)) ? angleDegrees : prevAngle;
38103811
}
38113812
for(i = 0; i < lbbArray.length - 1; i++) {
38123813
if(Lib.bBoxIntersect(lbbArray[i], lbbArray[i + 1], pad)) {
3813-
autoangle = angleRadians * (180 / Math.PI /* to degrees */);
3814+
autoangle = angleDegrees;
38143815
break;
38153816
}
38163817
}

0 commit comments

Comments
 (0)