Skip to content

Commit 0f43d33

Browse files
authored
Merge pull request #6260 from plotly/fix-6259
Avoid attaching selections to missing eventData
2 parents a159235 + 0afa52c commit 0f43d33

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

draftlogs/6260_fix.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Avoid attaching selections to missing eventData (regression introduced in 2.13.0) [[#6260](https://github.com/plotly/plotly.js/pull/6260)]

src/components/selections/select.js

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

454-
eventData.selections = gd.layout.selections;
455454
emitSelected(gd, eventData);
456455
}).catch(Lib.error);
457456
};
@@ -530,7 +529,6 @@ function selectOnClick(evt, gd, xAxes, yAxes, subplot, dragOptions, polygonOutli
530529
}
531530

532531
if(sendEvents) {
533-
eventData.selections = gd.layout.selections;
534532
emitSelected(gd, eventData);
535533
}
536534
}
@@ -1195,7 +1193,6 @@ function reselect(gd, selectionTesters, searchTraces, dragOptions) {
11951193
fillRangeItems(eventData, poly);
11961194
}
11971195

1198-
eventData.selections = gd.layout.selections;
11991196
emitSelected(gd, eventData);
12001197
}
12011198

@@ -1216,7 +1213,6 @@ function reselect(gd, selectionTesters, searchTraces, dragOptions) {
12161213

12171214
if(sendEvents) {
12181215
if(eventData.points.length) {
1219-
eventData.selections = gd.layout.selections;
12201216
emitSelected(gd, eventData);
12211217
} else {
12221218
gd.emit('plotly_deselect', null);
@@ -1507,14 +1503,22 @@ function getFillRangeItems(dragOptions) {
15071503
}
15081504

15091505
function emitSelecting(gd, eventData) {
1506+
if(drawMode(gd._fullLayout.dragmode)) return;
15101507
gd.emit('plotly_selecting', eventData);
15111508
}
15121509

15131510
function emitSelected(gd, eventData) {
1511+
if(drawMode(gd._fullLayout.dragmode)) return;
1512+
1513+
if(eventData) {
1514+
eventData.selections = (gd.layout || {}).selections || [];
1515+
}
1516+
15141517
gd.emit('plotly_selected', eventData);
15151518
}
15161519

15171520
function emitDeselect(gd) {
1521+
if(drawMode(gd._fullLayout.dragmode)) return;
15181522
gd.emit('plotly_deselect', null);
15191523
}
15201524

0 commit comments

Comments
 (0)