Skip to content

Commit 9c9ee75

Browse files
committed
ensure container passed into legend _draw function
1 parent 0a4fd73 commit 9c9ee75

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/components/legend/draw.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,21 @@ var helpers = require('./helpers');
2424

2525
var MAIN_TITLE = 1;
2626

27-
module.exports = function draw(gd, container) {
27+
module.exports = function draw(gd, opts) {
28+
if(!opts) opts = gd._fullLayout.legend || {};
29+
return _draw(gd, opts);
30+
};
31+
32+
function _draw(gd, container) {
2833
var fullLayout = gd._fullLayout;
2934
var clipId = 'legend' + fullLayout._uid;
3035
var layer;
3136

32-
// Check whether this is the main legend (ie. called without any container)
33-
var inHover = container && container._inHover;
37+
var inHover = container._inHover;
3438
if(inHover) {
3539
layer = container.layer;
3640
clipId += '-hover';
3741
} else {
38-
container = fullLayout.legend || {};
3942
layer = fullLayout._infolayer;
4043
}
4144

@@ -342,7 +345,7 @@ module.exports = function draw(gd, container) {
342345
});
343346
}
344347
}], gd);
345-
};
348+
}
346349

347350
function clickOrDoubleClick(gd, legend, legendItem, numClicks, evt) {
348351
var trace = legendItem.data()[0][0].trace;

0 commit comments

Comments
 (0)