Skip to content

Commit 5660bf5

Browse files
committed
🔪 call when not in a chain
and when `this` isn't important - ie in all of our helper functions but we still need `call` for `d3.behavior.drag()`
1 parent 569b378 commit 5660bf5

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

src/components/legend/draw.js

+10-11
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ module.exports = function draw(gd) {
7878
'shape-rendering': 'crispEdges'
7979
});
8080

81-
bg.call(Color.stroke, opts.bordercolor);
82-
bg.call(Color.fill, opts.bgcolor);
83-
bg.style('stroke-width', opts.borderwidth + 'px');
81+
bg.call(Color.stroke, opts.bordercolor)
82+
.call(Color.fill, opts.bgcolor)
83+
.style('stroke-width', opts.borderwidth + 'px');
8484

8585
var scrollBox = legend.selectAll('g.scrollbox')
8686
.data([0]);
@@ -229,7 +229,7 @@ module.exports = function draw(gd) {
229229
y: opts.borderwidth
230230
});
231231

232-
scrollBox.call(Drawing.setClipUrl, clipId);
232+
Drawing.setClipUrl(scrollBox, clipId);
233233

234234
Drawing.setRect(scrollBar, 0, 0, 0, 0);
235235
delete opts._scrollY;
@@ -268,7 +268,7 @@ module.exports = function draw(gd) {
268268
y: opts.borderwidth - scrollBoxY
269269
});
270270

271-
scrollBox.call(Drawing.setClipUrl, clipId);
271+
Drawing.setClipUrl(scrollBox, clipId);
272272

273273
scrollHandler(scrollBoxY, scrollBarHeight, scrollRatio);
274274

@@ -306,11 +306,10 @@ module.exports = function draw(gd) {
306306

307307
function scrollHandler(scrollBoxY, scrollBarHeight, scrollRatio) {
308308
opts._scrollY = gd._fullLayout.legend._scrollY = scrollBoxY;
309-
scrollBox
310-
.call(Drawing.setTranslate, 0, scrollBoxY);
309+
Drawing.setTranslate(scrollBox, 0, scrollBoxY);
311310

312-
scrollBar.call(
313-
Drawing.setRect,
311+
Drawing.setRect(
312+
scrollBar,
314313
legendWidth,
315314
constants.scrollBarMargin - scrollBoxY * scrollRatio,
316315
constants.scrollBarWidth,
@@ -441,7 +440,7 @@ function drawTexts(g, gd) {
441440
return Plotly.restyle(gd, update, traceIndex);
442441
});
443442
} else {
444-
text.call(textLayout);
443+
textLayout(text);
445444
}
446445
}
447446

@@ -671,7 +670,7 @@ function computeLegendDimensions(gd, groups, traces) {
671670
var legendItem = d[0],
672671
bg = d3.select(this).select('.legendtoggle');
673672

674-
bg.call(Drawing.setRect,
673+
Drawing.setRect(bg,
675674
0,
676675
-legendItem.height / 2,
677676
(gd._context.edits.legendText ? 0 : opts._width) + extraWidth,

0 commit comments

Comments
 (0)