Skip to content

Commit a7829cf

Browse files
committed
rm useless .exit().remove() :
- the exit selection will always be empty as the joined data is always [0].
1 parent 7b393d4 commit a7829cf

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/components/legend/draw.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ module.exports = function draw(gd) {
6969

7070
scrollBox.enter().append('g')
7171
.attr('class', 'scrollbox');
72-
scrollBox.exit().remove();
7372

7473
var scrollBar = legend.selectAll('rect.scrollbar')
7574
.data([0]);
@@ -86,8 +85,10 @@ module.exports = function draw(gd) {
8685

8786
var groups = scrollBox.selectAll('g.groups')
8887
.data(legendData);
88+
8989
groups.enter().append('g')
9090
.attr('class', 'groups');
91+
9192
groups.exit().remove();
9293

9394
if(helpers.isGrouped(opts)) {
@@ -116,11 +117,13 @@ module.exports = function draw(gd) {
116117

117118
var traceToggle = d3.select(this).selectAll('rect')
118119
.data([0]);
120+
119121
traceToggle.enter().append('rect')
120122
.classed('legendtoggle', true)
121123
.style('cursor', 'pointer')
122124
.attr('pointer-events', 'all')
123125
.call(Color.fill, 'rgba(0,0,0,0)');
126+
124127
traceToggle.on('click', function() {
125128
if(gd._dragged) return;
126129

@@ -188,6 +191,7 @@ module.exports = function draw(gd) {
188191
scrollPosition = scrollBox.attr('data-scroll') ? scrollBox.attr('data-scroll') : 0;
189192

190193
scrollBox.attr('transform', 'translate(0, ' + scrollPosition + ')');
194+
191195
bg.attr({
192196
width: opts.width - 2 * opts.borderwidth,
193197
height: scrollheight - 2 * opts.borderwidth,

0 commit comments

Comments
 (0)