@@ -50,7 +50,14 @@ var p2r = helpers.p2r;
50
50
var axValue = helpers . axValue ;
51
51
var getTransform = helpers . getTransform ;
52
52
53
+ function hasSubplot ( dragOptions ) {
54
+ // N.B. subplot may be falsy e.g zero sankey index!
55
+ return dragOptions . subplot !== undefined ;
56
+ }
57
+
53
58
function prepSelect ( evt , startX , startY , dragOptions , mode ) {
59
+ var isCartesian = ! hasSubplot ( dragOptions ) ;
60
+
54
61
var isFreeMode = freeMode ( mode ) ;
55
62
var isRectMode = rectMode ( mode ) ;
56
63
var isOpenMode = openMode ( mode ) ;
@@ -64,7 +71,7 @@ function prepSelect(evt, startX, startY, dragOptions, mode) {
64
71
var gd = dragOptions . gd ;
65
72
var fullLayout = gd . _fullLayout ;
66
73
var immediateSelect = isSelectMode && fullLayout . newselection . mode === 'immediate' &&
67
- ! dragOptions . subplot ; // N.B. only cartesian subplots have persistent selection
74
+ isCartesian ; // N.B. only cartesian subplots have persistent selection
68
75
69
76
var zoomLayer = fullLayout . _zoomlayer ;
70
77
var dragBBox = dragOptions . element . getBoundingClientRect ( ) ;
@@ -112,9 +119,9 @@ function prepSelect(evt, startX, startY, dragOptions, mode) {
112
119
opacity : isDrawMode ? newStyle . opacity / 2 : 1 ,
113
120
fill : ( isDrawMode && ! isOpenMode ) ? newStyle . fillcolor : 'none' ,
114
121
stroke : newStyle . line . color || (
115
- dragOptions . subplot !== undefined ?
116
- '#7f7f7f' : // non-cartesian subplot
117
- Color . contrast ( gd . _fullLayout . plot_bgcolor ) // cartesian subplot
122
+ isCartesian ?
123
+ Color . contrast ( gd . _fullLayout . plot_bgcolor ) :
124
+ '#7f7f7f' // non- cartesian subplot
118
125
) ,
119
126
'stroke-dasharray' : dashStyle ( newStyle . line . dash , newStyle . line . width ) ,
120
127
'stroke-width' : newStyle . line . width + 'px' ,
@@ -145,6 +152,8 @@ function prepSelect(evt, startX, startY, dragOptions, mode) {
145
152
146
153
if ( immediateSelect && ! evt . shiftKey ) {
147
154
dragOptions . _clearSubplotSelections = function ( ) {
155
+ if ( ! isCartesian ) return ;
156
+
148
157
var xRef = xAxis . _id ;
149
158
var yRef = yAxis . _id ;
150
159
deselectSubplot ( gd , xRef , yRef , searchTraces ) ;
@@ -719,7 +728,7 @@ function clearSelectionsCache(dragOptions, immediateSelect) {
719
728
var selections ;
720
729
if (
721
730
isSelectMode &&
722
- ! dragOptions . subplot // only allow cartesian - no mapbox for now
731
+ ! hasSubplot ( dragOptions ) // only allow cartesian - no mapbox for now
723
732
) {
724
733
selections = newSelections ( outlines , dragOptions ) ;
725
734
}
@@ -758,7 +767,10 @@ function determineSearchTraces(gd, xAxes, yAxes, subplot) {
758
767
759
768
if ( trace . visible !== true || ! trace . _module || ! trace . _module . selectPoints ) continue ;
760
769
761
- if ( subplot && ( trace . subplot === subplot || trace . geo === subplot ) ) {
770
+ if (
771
+ hasSubplot ( { subplot : subplot } ) &&
772
+ ( trace . subplot === subplot || trace . geo === subplot )
773
+ ) {
762
774
searchTraces . push ( createSearchInfo ( trace . _module , cd , xAxes [ 0 ] , yAxes [ 0 ] ) ) ;
763
775
} else if ( trace . type === 'splom' ) {
764
776
// FIXME: make sure we don't have more than single axis for splom
0 commit comments