@@ -1176,19 +1176,35 @@ function reselect(gd, selectionTesters, searchTraces, dragOptions) {
1176
1176
xRef = deselect . xref ;
1177
1177
yRef = deselect . yref ;
1178
1178
1179
- searchTraces = determineSearchTraces (
1180
- gd ,
1181
- [ getFromId ( gd , xRef , 'x' ) ] ,
1182
- [ getFromId ( gd , yRef , 'y' ) ] ,
1183
- xRef + yRef
1184
- ) ;
1185
-
1186
- for ( var k = 0 ; k < searchTraces . length ; k ++ ) {
1187
- var searchInfo = searchTraces [ k ] ;
1188
- searchInfo . _module . selectPoints ( searchInfo , false ) ;
1179
+ var foundSubplot = false ;
1180
+ for ( var q = 0 ; q < allSearchTraces . length ; q ++ ) {
1181
+ var a = allSearchTraces [ q ] ;
1182
+ if (
1183
+ ( a . xaxis && a . xaxis . _id === xRef ) &&
1184
+ ( a . yaxis && a . yaxis . _id === yRef )
1185
+ ) {
1186
+ foundSubplot = true ;
1187
+ break ;
1188
+ }
1189
1189
}
1190
1190
1191
- updateSelectedState ( gd , searchTraces ) ;
1191
+ if ( ! foundSubplot ) {
1192
+ // deselect traces in this subplot
1193
+
1194
+ searchTraces = determineSearchTraces (
1195
+ gd ,
1196
+ [ getFromId ( gd , xRef , 'x' ) ] ,
1197
+ [ getFromId ( gd , yRef , 'y' ) ] ,
1198
+ xRef + yRef
1199
+ ) ;
1200
+
1201
+ for ( var k = 0 ; k < searchTraces . length ; k ++ ) {
1202
+ var searchInfo = searchTraces [ k ] ;
1203
+ searchInfo . _module . selectPoints ( searchInfo , false ) ;
1204
+ }
1205
+
1206
+ updateSelectedState ( gd , searchTraces ) ;
1207
+ }
1192
1208
1193
1209
if ( sendEvents ) {
1194
1210
if ( eventData . points . length ) {
0 commit comments