Skip to content

Commit dbea03d

Browse files
committed
simplifies the check to see if legend fits
1 parent 9d8c158 commit dbea03d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/components/legend/draw.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -639,12 +639,12 @@ function computeLegendDimensions(gd, groups, traces) {
639639
});
640640

641641
// check if legend fits in one row
642-
oneRowLegend = (fullLayout.width - (fullLayout._size.r + fullLayout._size.l)) > borderwidth + fullTracesWidth - traceGap;
642+
oneRowLegend = fullLayout._size.w > borderwidth + fullTracesWidth - traceGap;
643643
traces.each(function(d) {
644644
var legendItem = d[0],
645645
traceWidth = oneRowLegend ? 40 + d[0].width : maxTraceWidth;
646646

647-
if((borderwidth + offsetX + traceGap + traceWidth) > (fullLayout.width - (fullLayout._size.r + fullLayout._size.l))) {
647+
if((borderwidth + offsetX + traceGap + traceWidth) > fullLayout._size.w) {
648648
offsetX = 0;
649649
rowHeight = rowHeight + maxTraceHeight;
650650
opts._height = opts._height + maxTraceHeight;

0 commit comments

Comments
 (0)