Skip to content

Commit 7ff8d92

Browse files
committed
Replace suspicious infinite loop test with check to never decrease the angle
1 parent 3f08ba8 commit 7ff8d92

File tree

1 file changed

+4
-14
lines changed

1 file changed

+4
-14
lines changed

src/plots/cartesian/axes.js

+4-14
Original file line numberDiff line numberDiff line change
@@ -3796,7 +3796,9 @@ axes.drawLabels = function(gd, ax, opts) {
37963796
, autoTickAngles[0]
37973797
);
37983798
}
3799-
3799+
if(prevAngle !== undefined) {
3800+
angle = Math.abs(angle) > Math.abs(prevAngle) ? angle : prevAngle;
3801+
}
38003802
for(i = 0; i < lbbArray.length - 1; i++) {
38013803
if(Lib.bBoxIntersect(lbbArray[i], lbbArray[i + 1], pad)) {
38023804
autoangle = angle;
@@ -3815,19 +3817,7 @@ axes.drawLabels = function(gd, ax, opts) {
38153817
ax._selections[cls] = tickLabels;
38163818
}
38173819

3818-
var seq = [allLabelsReady];
3819-
3820-
// N.B. during auto-margin redraws, if the axis fixed its label overlaps
3821-
// by rotating 90 degrees, do not attempt to re-fix its label overlaps
3822-
// as this can lead to infinite redraw loops!
3823-
if(ax.automargin && fullLayout._redrawFromAutoMarginCount && Math.abs(prevAngle) === 90) {
3824-
autoangle = prevAngle;
3825-
seq.push(function() {
3826-
positionLabels(tickLabels, prevAngle);
3827-
});
3828-
} else {
3829-
seq.push(fixLabelOverlaps);
3830-
}
3820+
var seq = [allLabelsReady, fixLabelOverlaps];
38313821

38323822
// save current tick angle for future redraws
38333823
if(ax._tickAngles) {

0 commit comments

Comments
 (0)