Skip to content

Commit 1d35e92

Browse files
committed
Revert 264617b and 7ff8d92
1 parent c0e2758 commit 1d35e92

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

Diff for: src/plots/cartesian/axes.js

+12-5
Original file line numberDiff line numberDiff line change
@@ -3805,10 +3805,6 @@ axes.drawLabels = function(gd, ax, opts) {
38053805
}
38063806
newAngle = angleRadians * (180 / Math.PI /* to degrees */);
38073807
}
3808-
if(prevAngle !== undefined) {
3809-
var prevAngleRadians = prevAngle * Math.PI / 180;
3810-
newAngle = Math.abs(Math.cos(newAngle * 180 / Math.PI)) < Math.abs(Math.cos(prevAngleRadians)) ? newAngle : prevAngle;
3811-
}
38123808
for(i = 0; i < lbbArray.length - 1; i++) {
38133809
if(Lib.bBoxIntersect(lbbArray[i], lbbArray[i + 1], pad)) {
38143810
autoangle = newAngle;
@@ -3827,8 +3823,19 @@ axes.drawLabels = function(gd, ax, opts) {
38273823
ax._selections[cls] = tickLabels;
38283824
}
38293825

3830-
var seq = [allLabelsReady, fixLabelOverlaps];
3826+
var seq = [allLabelsReady];
38313827

3828+
// N.B. during auto-margin redraws, if the axis fixed its label overlaps
3829+
// by rotating 90 degrees, do not attempt to re-fix its label overlaps
3830+
// as this can lead to infinite redraw loops!
3831+
if(ax.automargin && fullLayout._redrawFromAutoMarginCount & prevAngle === 90) {
3832+
autoangle = prevAngle;
3833+
seq.push(function() {
3834+
positionLabels(tickLabels, prevAngle);
3835+
});
3836+
} else {
3837+
seq.push(fixLabelOverlaps);
3838+
}
38323839
// save current tick angle for future redraws
38333840
if(ax._tickAngles) {
38343841
seq.push(function() {

0 commit comments

Comments
 (0)