@@ -451,7 +451,9 @@ function prepSelect(evt, startX, startY, dragOptions, mode) {
451
451
dragOptions . doneFnCompleted ( selection ) ;
452
452
}
453
453
454
- emitSelected ( gd , eventData ) ;
454
+ if ( isSelectMode ) {
455
+ emitSelected ( gd , eventData ) ;
456
+ }
455
457
} ) . catch ( Lib . error ) ;
456
458
} ;
457
459
}
@@ -673,15 +675,23 @@ function coerceSelectionsCache(evt, gd, dragOptions) {
673
675
}
674
676
}
675
677
678
+ function hasActiveShape ( gd ) {
679
+ return gd . _fullLayout . _activeShapeIndex >= 0 ;
680
+ }
681
+
682
+ function hasActiveSelection ( gd ) {
683
+ return gd . _fullLayout . _activeSelectionIndex >= 0 ;
684
+ }
685
+
676
686
function clearSelectionsCache ( dragOptions , immediateSelect ) {
677
687
var dragmode = dragOptions . dragmode ;
678
688
var plotinfo = dragOptions . plotinfo ;
679
689
680
690
var gd = dragOptions . gd ;
681
- if ( gd . _fullLayout . _activeShapeIndex >= 0 ) {
691
+ if ( hasActiveShape ( gd ) ) {
682
692
gd . _fullLayout . _deactivateShape ( gd ) ;
683
693
}
684
- if ( gd . _fullLayout . _activeSelectionIndex >= 0 ) {
694
+ if ( hasActiveSelection ( gd ) ) {
685
695
gd . _fullLayout . _deactivateSelection ( gd ) ;
686
696
}
687
697
@@ -1503,13 +1513,10 @@ function getFillRangeItems(dragOptions) {
1503
1513
}
1504
1514
1505
1515
function emitSelecting ( gd , eventData ) {
1506
- if ( drawMode ( gd . _fullLayout . dragmode ) ) return ;
1507
1516
gd . emit ( 'plotly_selecting' , eventData ) ;
1508
1517
}
1509
1518
1510
1519
function emitSelected ( gd , eventData ) {
1511
- if ( drawMode ( gd . _fullLayout . dragmode ) ) return ;
1512
-
1513
1520
if ( eventData ) {
1514
1521
eventData . selections = ( gd . layout || { } ) . selections || [ ] ;
1515
1522
}
@@ -1518,7 +1525,6 @@ function emitSelected(gd, eventData) {
1518
1525
}
1519
1526
1520
1527
function emitDeselect ( gd ) {
1521
- if ( drawMode ( gd . _fullLayout . dragmode ) ) return ;
1522
1528
gd . emit ( 'plotly_deselect' , null ) ;
1523
1529
}
1524
1530
0 commit comments