@@ -50,7 +50,14 @@ var p2r = helpers.p2r;
50
50
var axValue = helpers . axValue ;
51
51
var getTransform = helpers . getTransform ;
52
52
53
+ function cartesianDrag ( 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 isCartesianDrag = cartesianDrag ( 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
+ ! isCartesianDrag ; // N.B. only cartesian subplots have persistent selection
68
75
69
76
var zoomLayer = fullLayout . _zoomlayer ;
70
77
var dragBBox = dragOptions . element . getBoundingClientRect ( ) ;
@@ -112,7 +119,7 @@ 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 ?
122
+ isCartesianDrag ?
116
123
'#7f7f7f' : // non-cartesian subplot
117
124
Color . contrast ( gd . _fullLayout . plot_bgcolor ) // cartesian subplot
118
125
) ,
@@ -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 ( isCartesianDrag ) return ;
156
+
148
157
var xRef = xAxis . _id ;
149
158
var yRef = yAxis . _id ;
150
159
deselectSubplot ( gd , xRef , yRef , searchTraces ) ;
@@ -709,7 +718,7 @@ function clearSelectionsCache(dragOptions, immediateSelect) {
709
718
var selections ;
710
719
if (
711
720
isSelectMode &&
712
- ! dragOptions . subplot // only allow cartesian - no mapbox for now
721
+ ! cartesianDrag ( dragOptions ) // only allow cartesian - no mapbox for now
713
722
) {
714
723
selections = newSelections ( outlines , dragOptions ) ;
715
724
}
@@ -748,7 +757,10 @@ function determineSearchTraces(gd, xAxes, yAxes, subplot) {
748
757
749
758
if ( trace . visible !== true || ! trace . _module || ! trace . _module . selectPoints ) continue ;
750
759
751
- if ( subplot && ( trace . subplot === subplot || trace . geo === subplot ) ) {
760
+ if (
761
+ cartesianDrag ( { subplot : subplot } ) &&
762
+ ( trace . subplot === subplot || trace . geo === subplot )
763
+ ) {
752
764
searchTraces . push ( createSearchInfo ( trace . _module , cd , xAxes [ 0 ] , yAxes [ 0 ] ) ) ;
753
765
} else if ( trace . type === 'splom' ) {
754
766
// FIXME: make sure we don't have more than single axis for splom
0 commit comments