@@ -205,14 +205,14 @@ function drawOne(gd, opts) {
205205 traces . exit ( ) . remove ( ) ;
206206
207207 traces . style ( 'opacity' , function ( d ) {
208- var legendItem = d [ 0 ] ;
209- var trace = legendItem . trace ;
208+ const legendItem = d [ 0 ] ;
209+ const trace = legendItem . trace ;
210210
211211 // Toggle opacity of legend group titles if all items in the group are hidden
212212 if ( legendItem . groupTitle ) {
213- var groupName = trace . legendgroup ;
214- var shapes = ( fullLayout . shapes || [ ] ) . filter ( function ( s ) { return s . showlegend ; } ) ;
215- var anyVisible = gd . _fullData . concat ( shapes ) . some ( function ( item ) {
213+ const groupName = trace . legendgroup ;
214+ const shapes = ( fullLayout . shapes || [ ] ) . filter ( function ( s ) { return s . showlegend ; } ) ;
215+ const anyVisible = gd . _fullData . concat ( shapes ) . some ( function ( item ) {
216216 return item . legendgroup === groupName &&
217217 ( item . legend || 'legend' ) === legendId &&
218218 item . visible === true ;
@@ -255,9 +255,9 @@ function drawOne(gd, opts) {
255255 }
256256
257257 // Toggle opacity of legend titles if all items in the legend are hidden
258- var shapes = ( fullLayout . shapes || [ ] ) . filter ( function ( s ) { return s . showlegend ; } ) ;
259- var anyVisible = gd . _fullData . concat ( shapes ) . some ( function ( item ) {
260- var inThisLegend = ( item . legend || 'legend' ) === legendId ;
258+ const shapes = ( fullLayout . shapes || [ ] ) . filter ( function ( s ) { return s . showlegend ; } ) ;
259+ const anyVisible = gd . _fullData . concat ( shapes ) . some ( function ( item ) {
260+ const inThisLegend = ( item . legend || 'legend' ) === legendId ;
261261 return inThisLegend && item . visible === true ;
262262 } ) ;
263263
@@ -667,18 +667,18 @@ function setupTraceToggle(g, gd, legendId) {
667667
668668function setupTitleToggle ( scrollBox , gd , legendObj , legendId ) {
669669 // For now, skip title click for legends containing pie-like traces
670- var hasPie = gd . _fullData . some ( function ( trace ) {
671- var legend = trace . legend || 'legend' ;
672- var inThisLegend = Array . isArray ( legend ) ? legend . includes ( legendId ) : legend === legendId ;
670+ const hasPie = gd . _fullData . some ( function ( trace ) {
671+ const legend = trace . legend || 'legend' ;
672+ const inThisLegend = Array . isArray ( legend ) ? legend . includes ( legendId ) : legend === legendId ;
673673 return inThisLegend && Registry . traceIs ( trace , 'pie-like' ) ;
674674 } ) ;
675675 if ( hasPie ) return ;
676676
677- var doubleClickDelay = gd . _context . doubleClickDelay ;
677+ const doubleClickDelay = gd . _context . doubleClickDelay ;
678678 var newMouseDownTime ;
679679 var numClicks = 1 ;
680680
681- var titleToggle = Lib . ensureSingle ( scrollBox , 'rect' , legendId + 'titletoggle' , function ( s ) {
681+ const titleToggle = Lib . ensureSingle ( scrollBox , 'rect' , legendId + 'titletoggle' , function ( s ) {
682682 if ( ! gd . _context . staticPlot ) {
683683 s . style ( 'cursor' , 'pointer' ) . attr ( 'pointer-events' , 'all' ) ;
684684 }
@@ -705,7 +705,7 @@ function setupTitleToggle(scrollBox, gd, legendObj, legendId) {
705705 numClicks = Math . max ( numClicks - 1 , 1 ) ;
706706 }
707707
708- var evtData = {
708+ const evtData = {
709709 event : d3 . event ,
710710 legendId : legendId ,
711711 data : gd . data ,
@@ -715,7 +715,7 @@ function setupTitleToggle(scrollBox, gd, legendObj, legendId) {
715715 } ;
716716
717717 if ( numClicks === 1 && legendObj . titleclick ) {
718- var clickVal = Events . triggerHandler ( gd , 'plotly_legendtitleclick' , evtData ) ;
718+ const clickVal = Events . triggerHandler ( gd , 'plotly_legendtitleclick' , evtData ) ;
719719 if ( clickVal === false ) return ;
720720
721721 legendObj . _titleClickTimeout = setTimeout ( function ( ) {
@@ -725,21 +725,21 @@ function setupTitleToggle(scrollBox, gd, legendObj, legendId) {
725725 if ( legendObj . _titleClickTimeout ) clearTimeout ( legendObj . _titleClickTimeout ) ;
726726 gd . _legendMouseDownTime = 0 ;
727727
728- var dblClickVal = Events . triggerHandler ( gd , 'plotly_legendtitledoubleclick' , evtData ) ;
728+ const dblClickVal = Events . triggerHandler ( gd , 'plotly_legendtitledoubleclick' , evtData ) ;
729729 if ( dblClickVal !== false && legendObj . titledoubleclick ) handleTitleClick ( gd , legendObj , legendObj . titledoubleclick ) ;
730730 }
731731 } ) ;
732732}
733733
734734function positionTitleToggle ( scrollBox , legendObj , legendId ) {
735- var titleToggle = scrollBox . select ( '.' + legendId + 'titletoggle' ) ;
735+ const titleToggle = scrollBox . select ( '.' + legendId + 'titletoggle' ) ;
736736 if ( ! titleToggle . size ( ) ) return ;
737737
738- var side = legendObj . title . side || 'top' ;
739- var bw = legendObj . borderwidth ;
738+ const side = legendObj . title . side || 'top' ;
739+ const bw = legendObj . borderwidth ;
740740 var x = bw ;
741- var width = legendObj . _titleWidth + 2 * constants . titlePad ;
742- var height = legendObj . _titleHeight + 2 * constants . titlePad ;
741+ const width = legendObj . _titleWidth + 2 * constants . titlePad ;
742+ const height = legendObj . _titleHeight + 2 * constants . titlePad ;
743743
744744
745745 if ( side === 'top center' ) {
0 commit comments