Skip to content

Commit cbdc017

Browse files
committed
emit selection events in drawmode when selection change
1 parent a4038e3 commit cbdc017

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

src/components/selections/select.js

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,9 @@ function prepSelect(evt, startX, startY, dragOptions, mode) {
451451
dragOptions.doneFnCompleted(selection);
452452
}
453453

454-
emitSelected(gd, eventData);
454+
if(isSelectMode) {
455+
emitSelected(gd, eventData);
456+
}
455457
}).catch(Lib.error);
456458
};
457459
}
@@ -673,15 +675,23 @@ function coerceSelectionsCache(evt, gd, dragOptions) {
673675
}
674676
}
675677

678+
function hasActiveShape(gd) {
679+
return gd._fullLayout._activeShapeIndex >= 0;
680+
}
681+
682+
function hasActiveSelection(gd) {
683+
return gd._fullLayout._activeSelectionIndex >= 0;
684+
}
685+
676686
function clearSelectionsCache(dragOptions, immediateSelect) {
677687
var dragmode = dragOptions.dragmode;
678688
var plotinfo = dragOptions.plotinfo;
679689

680690
var gd = dragOptions.gd;
681-
if(gd._fullLayout._activeShapeIndex >= 0) {
691+
if(hasActiveShape(gd)) {
682692
gd._fullLayout._deactivateShape(gd);
683693
}
684-
if(gd._fullLayout._activeSelectionIndex >= 0) {
694+
if(hasActiveSelection(gd)) {
685695
gd._fullLayout._deactivateSelection(gd);
686696
}
687697

@@ -1503,13 +1513,10 @@ function getFillRangeItems(dragOptions) {
15031513
}
15041514

15051515
function emitSelecting(gd, eventData) {
1506-
if(drawMode(gd._fullLayout.dragmode)) return;
15071516
gd.emit('plotly_selecting', eventData);
15081517
}
15091518

15101519
function emitSelected(gd, eventData) {
1511-
if(drawMode(gd._fullLayout.dragmode)) return;
1512-
15131520
if(eventData) {
15141521
eventData.selections = (gd.layout || {}).selections || [];
15151522
}
@@ -1518,7 +1525,6 @@ function emitSelected(gd, eventData) {
15181525
}
15191526

15201527
function emitDeselect(gd) {
1521-
if(drawMode(gd._fullLayout.dragmode)) return;
15221528
gd.emit('plotly_deselect', null);
15231529
}
15241530

0 commit comments

Comments
 (0)