Skip to content

Commit 05b6d77

Browse files
Fix syntax
1 parent 4c1a865 commit 05b6d77

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

src/components/legend/draw.js

+9-9
Original file line numberDiff line numberDiff line change
@@ -355,15 +355,15 @@ function getTraceWidth(trace, legendObj, textGap) {
355355
var legendItem = trace[0];
356356
var legendWidth = legendItem.width;
357357

358-
var traceLegendWidth = legendItem.trace.legendwidth || legendObj.entrywidth
358+
var traceLegendWidth = legendItem.trace.legendwidth || legendObj.entrywidth;
359359

360-
if (traceLegendWidth) {
361-
if (legendObj.widthmode === "pixels") {
362-
return traceLegendWidth + textGap
363-
} else {
364-
return legendObj._maxWidth * traceLegendWidth
365-
}
360+
if(traceLegendWidth) {
361+
if(legendObj.widthmode === 'pixels') {
362+
return traceLegendWidth + textGap;
363+
} else {
364+
return legendObj._maxWidth * traceLegendWidth;
366365
}
366+
}
367367

368368
return legendWidth + textGap;
369369
}
@@ -772,7 +772,7 @@ function computeLegendDimensions(gd, groups, traces, legendObj) {
772772
var w = getTraceWidth(d, legendObj, textGap, isGrouped);
773773
var next = (oneRowLegend ? w : maxItemWidth);
774774

775-
if (legendObj.widthmode !== 'fraction') {
775+
if(legendObj.widthmode !== 'fraction') {
776776
next += itemGap;
777777
}
778778

@@ -831,7 +831,7 @@ function computeLegendDimensions(gd, groups, traces, legendObj) {
831831
traceWidth = legendGroupWidths[legendgroup];
832832
}
833833
var w = isEditable ? textGap : (toggleRectWidth || traceWidth);
834-
if(!isVertical && legendObj.widthmode !== "fraction") {
834+
if(!isVertical && legendObj.widthmode !== 'fraction') {
835835
w += itemGap / 2;
836836
}
837837
Drawing.setRect(traceToggle, 0, -h / 2, w, h);

test/jasmine/tests/legend_test.js

-2
Original file line numberDiff line numberDiff line change
@@ -2420,8 +2420,6 @@ describe('legend with custom legendwidth', function() {
24202420
}).then(done);
24212421
});
24222422

2423-
2424-
24252423
it('should change width when legend has entrywidth and widthmode is fraction', function(done) {
24262424
var extendedLayout = Lib.extendDeep([], layout);
24272425
extendedLayout.legend.widthmode = 'fraction';

0 commit comments

Comments
 (0)