@@ -44,8 +44,22 @@ module.exports = function prepSelect(e, startX, startY, dragOptions, mode) {
44
44
yAxisIds = dragOptions . yaxes . map ( getAxId ) ,
45
45
allAxes = dragOptions . xaxes . concat ( dragOptions . yaxes ) ,
46
46
filterPoly , testPoly , mergedPolygons , currentPolygon ,
47
- subtract = e . altKey ;
47
+ subtract = e . altKey ,
48
+ priorSubplotTarget = dragOptions . gd . _priorSubplotTarget ;
48
49
50
+ if ( priorSubplotTarget && plotinfo . id != priorSubplotTarget . id ) {
51
+
52
+ for ( i = 0 ; i < priorSubplotTarget . traces . length ; i ++ ) {
53
+ searchInfo = priorSubplotTarget . traces [ i ] ;
54
+ searchInfo . selectPoints ( searchInfo , false ) ;
55
+ }
56
+
57
+ updateSelectedState ( gd , priorSubplotTarget . traces ) ;
58
+ priorSubplotTarget = { } ;
59
+ plotinfo . selection = { } ;
60
+ plotinfo . selection . polygons = dragOptions . polygons = [ ] ;
61
+ plotinfo . selection . mergedPolygons = dragOptions . mergedPolygons = [ ] ;
62
+ }
49
63
50
64
// take over selection polygons from prev mode, if any
51
65
if ( ( e . shiftKey || e . altKey ) && ( plotinfo . selection && plotinfo . selection . polygons ) && ! dragOptions . polygons ) {
@@ -67,9 +81,10 @@ module.exports = function prepSelect(e, startX, startY, dragOptions, mode) {
67
81
68
82
outlines . enter ( )
69
83
. append ( 'path' )
70
- . attr ( 'class' , function ( d ) { return 'select-outline select-outline-' + d ; } )
71
- . attr ( 'transform' , 'translate(' + xs + ', ' + ys + ')' )
72
- . attr ( 'd' , path0 + 'Z' ) ;
84
+ . attr ( 'class' , function ( d ) { return 'select-outline select-outline-' + d ; } ) ;
85
+
86
+ outlines . attr ( 'transform' , 'translate(' + xs + ', ' + ys + ')' )
87
+ . attr ( 'd' , path0 + 'Z' ) ;
73
88
74
89
var corners = zoomLayer . append ( 'path' )
75
90
. attr ( 'class' , 'zoombox-corners' )
@@ -225,8 +240,7 @@ module.exports = function prepSelect(e, startX, startY, dragOptions, mode) {
225
240
var ppts = mergedPolygons [ i ] ;
226
241
paths . push ( ppts . join ( 'L' ) + 'L' + ppts [ 0 ] ) ;
227
242
}
228
- outlines . attr ( 'd' , 'M' + paths . join ( 'M' ) + 'Z' )
229
- . attr ( 'transform' , 'translate(' + xs + ', ' + ys + ')' ) ;
243
+ outlines . attr ( 'd' , 'M' + paths . join ( 'M' ) + 'Z' ) ;
230
244
231
245
throttle . throttle (
232
246
throttleID ,
@@ -288,6 +302,7 @@ module.exports = function prepSelect(e, startX, startY, dragOptions, mode) {
288
302
throttle . done ( throttleID ) . then ( function ( ) {
289
303
throttle . clear ( throttleID ) ;
290
304
dragOptions . gd . emit ( 'plotly_selected' , eventData ) ;
305
+ dragOptions . gd . _priorSubplotTarget = { id : plotinfo . id , traces :searchTraces } ;
291
306
292
307
if ( currentPolygon && dragOptions . polygons ) {
293
308
// save last polygons
0 commit comments