@@ -465,14 +465,14 @@ function multiTester(list) {
465465
466466function coerceSelectionsCache ( evt , gd , dragOptions ) {
467467 var fullLayout = gd . _fullLayout ;
468- var zoomLayer = fullLayout . _zoomlayer ;
469468 var plotinfo = dragOptions . plotinfo ;
470469
471470 var selectingOnSameSubplot = (
472- fullLayout . _lastSelectedSubplot &&
473- fullLayout . _lastSelectedSubplot === plotinfo . id
471+ fullLayout . _lastSelectedSubplot &&
472+ fullLayout . _lastSelectedSubplot === plotinfo . id
474473 ) ;
475474 var hasModifierKey = evt . shiftKey || evt . altKey ;
475+
476476 if ( selectingOnSameSubplot && hasModifierKey &&
477477 ( plotinfo . selection && plotinfo . selection . selectionDefs ) && ! dragOptions . selectionDefs ) {
478478 // take over selection definitions from prev mode, if any
@@ -484,7 +484,7 @@ function coerceSelectionsCache(evt, gd, dragOptions) {
484484
485485 // clear selection outline when selecting a different subplot
486486 if ( ! selectingOnSameSubplot ) {
487- clearSelect ( zoomLayer ) ;
487+ clearSelect ( gd ) ;
488488 fullLayout . _lastSelectedSubplot = plotinfo . id ;
489489 }
490490}
@@ -774,11 +774,15 @@ function fillSelectionItem(selection, searchInfo) {
774774 return selection ;
775775}
776776
777- function clearSelect ( zoomlayer ) {
778- // until we get around to persistent selections, remove the outline
779- // here. The selection itself will be removed when the plot redraws
780- // at the end.
781- zoomlayer . selectAll ( '.select-outline' ) . remove ( ) ;
777+ // until we get around to persistent selections, remove the outline
778+ // here. The selection itself will be removed when the plot redraws
779+ // at the end.
780+ function clearSelect ( gd ) {
781+ var fullLayout = gd . _fullLayout || { } ;
782+ var zoomlayer = fullLayout . _zoomlayer ;
783+ if ( zoomlayer ) {
784+ zoomlayer . selectAll ( '.select-outline' ) . remove ( ) ;
785+ }
782786}
783787
784788module . exports = {
0 commit comments