Skip to content

Commit

Permalink
Replace suspicious infinite loop test with check to never decrease th…
Browse files Browse the repository at this point in the history
…e angle
  • Loading branch information
my-tien committed Nov 24, 2023
1 parent 3f08ba8 commit 7ff8d92
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions src/plots/cartesian/axes.js
Original file line number Diff line number Diff line change
Expand Up @@ -3796,7 +3796,9 @@ axes.drawLabels = function(gd, ax, opts) {
, autoTickAngles[0]
);
}

if(prevAngle !== undefined) {
angle = Math.abs(angle) > Math.abs(prevAngle) ? angle : prevAngle;
}
for(i = 0; i < lbbArray.length - 1; i++) {
if(Lib.bBoxIntersect(lbbArray[i], lbbArray[i + 1], pad)) {
autoangle = angle;
Expand All @@ -3815,19 +3817,7 @@ axes.drawLabels = function(gd, ax, opts) {
ax._selections[cls] = tickLabels;
}

var seq = [allLabelsReady];

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

// save current tick angle for future redraws
if(ax._tickAngles) {
Expand Down

0 comments on commit 7ff8d92

Please sign in to comment.