From 7ff8d92650d35f0bea24dde3496d749b031a8185 Mon Sep 17 00:00:00 2001 From: My-Tien Nguyen Date: Fri, 24 Nov 2023 12:09:47 +0100 Subject: [PATCH] Replace suspicious infinite loop test with check to never decrease the angle --- src/plots/cartesian/axes.js | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/src/plots/cartesian/axes.js b/src/plots/cartesian/axes.js index 22b2bcc2bc7..eda5059e36d 100644 --- a/src/plots/cartesian/axes.js +++ b/src/plots/cartesian/axes.js @@ -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; @@ -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) {