@@ -53,35 +53,28 @@ function prepSelect(e, startX, startY, dragOptions, mode) {
53
53
var filterPoly , testPoly , mergedPolygons , currentPolygon ;
54
54
var i , cd , trace , searchInfo , eventData ;
55
55
56
- // take over selection polygons from prev mode, if any
57
- if ( ( e . shiftKey || e . altKey ) && ( plotinfo . selection && plotinfo . selection . polygons ) && ! dragOptions . polygons ) {
58
- dragOptions . polygons = plotinfo . selection . polygons ;
59
- dragOptions . mergedPolygons = plotinfo . selection . mergedPolygons ;
60
- }
61
- // create new polygons, if shift mode
62
- else if ( ( ! e . shiftKey && ! e . altKey ) || ( ( e . shiftKey || e . altKey ) && ! plotinfo . selection ) ) {
63
- plotinfo . selection = { } ;
64
- plotinfo . selection . polygons = dragOptions . polygons = [ ] ;
65
- plotinfo . selection . mergedPolygons = dragOptions . mergedPolygons = [ ] ;
56
+ if ( fullLayout . _lastSelectedSubplot && fullLayout . _lastSelectedSubplot === plotinfo . id ) {
57
+ // take over selection polygons from prev mode, if any
58
+ if ( ( e . shiftKey || e . altKey ) && ( plotinfo . selection && plotinfo . selection . polygons ) && ! dragOptions . polygons ) {
59
+ dragOptions . polygons = plotinfo . selection . polygons ;
60
+ dragOptions . mergedPolygons = plotinfo . selection . mergedPolygons ;
61
+ }
62
+ // create new polygons, if shift mode
63
+ else if ( ( ! e . shiftKey && ! e . altKey ) || ( ( e . shiftKey || e . altKey ) && ! plotinfo . selection ) ) {
64
+ plotinfo . selection = { } ;
65
+ plotinfo . selection . polygons = dragOptions . polygons = [ ] ;
66
+ plotinfo . selection . mergedPolygons = dragOptions . mergedPolygons = [ ] ;
67
+ }
68
+ } else {
69
+ // do not allow multi-selection across different subplots
70
+ clearSelect ( zoomLayer ) ;
71
+ fullLayout . _lastSelectedSubplot = plotinfo . id ;
66
72
}
67
73
68
74
if ( mode === 'lasso' ) {
69
75
filterPoly = filteredPolygon ( [ [ x0 , y0 ] ] , constants . BENDPX ) ;
70
76
}
71
77
72
- // FIXME: find a better way to clear selection outlines for splom
73
- if ( ! e . shiftKey && ! e . altKey ) {
74
- for ( i = 0 ; i < gd . calcdata . length ; i ++ ) {
75
- cd = gd . calcdata [ i ] ;
76
- trace = cd [ 0 ] . trace ;
77
-
78
- if ( trace . type === 'splom' ) {
79
- zoomLayer . selectAll ( '.select-outline' ) . remove ( ) ;
80
- break ;
81
- }
82
- }
83
- }
84
-
85
78
var outlines = zoomLayer . selectAll ( 'path.select-outline-' + plotinfo . id ) . data ( [ 1 , 2 ] ) ;
86
79
87
80
outlines . enter ( )
@@ -365,11 +358,9 @@ function updateSelectedState(gd, searchTraces, eventData) {
365
358
delete trace . selectedpoints ;
366
359
delete trace . _input . selectedpoints ;
367
360
}
368
-
369
- // FIXME: make sure there is no better way to clear selection for sploms
370
- gd . _fullLayout . _zoomlayer . selectAll ( '.select-outline' ) . remove ( ) ;
371
361
}
372
362
363
+ // group searchInfo traces by trace modules
373
364
var lookup = { } ;
374
365
375
366
for ( i = 0 ; i < searchTraces . length ; i ++ ) {
0 commit comments