Skip to content

Commit cbedb42

Browse files
committed
speed up fraction checks
1 parent 42f4cde commit cbedb42

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/components/legend/draw.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -636,6 +636,7 @@ function computeLegendDimensions(gd, groups, traces, legendObj) {
636636

637637
var isVertical = helpers.isVertical(legendObj);
638638
var isGrouped = helpers.isGrouped(legendObj);
639+
var isFraction = legendObj.entrywidthmode === 'fraction';
639640

640641
var bw = legendObj.borderwidth;
641642
var bw2 = 2 * bw;
@@ -767,7 +768,7 @@ function computeLegendDimensions(gd, groups, traces, legendObj) {
767768
var w = getTraceWidth(d, legendObj, textGap, isGrouped);
768769
var next = (oneRowLegend ? w : maxItemWidth);
769770

770-
if(legendObj.entrywidthmode !== 'fraction') {
771+
if(!isFraction) {
771772
next += itemGap;
772773
}
773774

@@ -826,7 +827,7 @@ function computeLegendDimensions(gd, groups, traces, legendObj) {
826827
traceWidth = legendGroupWidths[legendgroup];
827828
}
828829
var w = isEditable ? textGap : (toggleRectWidth || traceWidth);
829-
if(!isVertical && legendObj.entrywidthmode !== 'fraction') {
830+
if(!isVertical && !isFraction) {
830831
w += itemGap / 2;
831832
}
832833
Drawing.setRect(traceToggle, 0, -h / 2, w, h);

0 commit comments

Comments
 (0)