@@ -69,7 +69,6 @@ module.exports = function draw(gd) {
69
69
70
70
scrollBox . enter ( ) . append ( 'g' )
71
71
. attr ( 'class' , 'scrollbox' ) ;
72
- scrollBox . exit ( ) . remove ( ) ;
73
72
74
73
var scrollBar = legend . selectAll ( 'rect.scrollbar' )
75
74
. data ( [ 0 ] ) ;
@@ -86,8 +85,10 @@ module.exports = function draw(gd) {
86
85
87
86
var groups = scrollBox . selectAll ( 'g.groups' )
88
87
. data ( legendData ) ;
88
+
89
89
groups . enter ( ) . append ( 'g' )
90
90
. attr ( 'class' , 'groups' ) ;
91
+
91
92
groups . exit ( ) . remove ( ) ;
92
93
93
94
if ( helpers . isGrouped ( opts ) ) {
@@ -116,11 +117,13 @@ module.exports = function draw(gd) {
116
117
117
118
var traceToggle = d3 . select ( this ) . selectAll ( 'rect' )
118
119
. data ( [ 0 ] ) ;
120
+
119
121
traceToggle . enter ( ) . append ( 'rect' )
120
122
. classed ( 'legendtoggle' , true )
121
123
. style ( 'cursor' , 'pointer' )
122
124
. attr ( 'pointer-events' , 'all' )
123
125
. call ( Color . fill , 'rgba(0,0,0,0)' ) ;
126
+
124
127
traceToggle . on ( 'click' , function ( ) {
125
128
if ( gd . _dragged ) return ;
126
129
@@ -188,6 +191,7 @@ module.exports = function draw(gd) {
188
191
scrollPosition = scrollBox . attr ( 'data-scroll' ) ? scrollBox . attr ( 'data-scroll' ) : 0 ;
189
192
190
193
scrollBox . attr ( 'transform' , 'translate(0, ' + scrollPosition + ')' ) ;
194
+
191
195
bg . attr ( {
192
196
width : opts . width - 2 * opts . borderwidth ,
193
197
height : scrollheight - 2 * opts . borderwidth ,
0 commit comments