Skip to content

Commit 0f03f1f

Browse files
committed
fix subplot state on deselect single selections
1 parent 293abfb commit 0f03f1f

File tree

1 file changed

+27
-11
lines changed

1 file changed

+27
-11
lines changed

src/components/selections/select.js

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1176,19 +1176,35 @@ function reselect(gd, selectionTesters, searchTraces, dragOptions) {
11761176
xRef = deselect.xref;
11771177
yRef = deselect.yref;
11781178

1179-
searchTraces = determineSearchTraces(
1180-
gd,
1181-
[getFromId(gd, xRef, 'x')],
1182-
[getFromId(gd, yRef, 'y')],
1183-
xRef + yRef
1184-
);
1185-
1186-
for(var k = 0; k < searchTraces.length; k++) {
1187-
var searchInfo = searchTraces[k];
1188-
searchInfo._module.selectPoints(searchInfo, false);
1179+
var foundSubplot = false;
1180+
for(var q = 0; q < allSearchTraces.length; q++) {
1181+
var a = allSearchTraces[q];
1182+
if(
1183+
(a.xaxis && a.xaxis._id === xRef) &&
1184+
(a.yaxis && a.yaxis._id === yRef)
1185+
) {
1186+
foundSubplot = true;
1187+
break;
1188+
}
11891189
}
11901190

1191-
updateSelectedState(gd, searchTraces);
1191+
if(!foundSubplot) {
1192+
// deselect traces in this subplot
1193+
1194+
searchTraces = determineSearchTraces(
1195+
gd,
1196+
[getFromId(gd, xRef, 'x')],
1197+
[getFromId(gd, yRef, 'y')],
1198+
xRef + yRef
1199+
);
1200+
1201+
for(var k = 0; k < searchTraces.length; k++) {
1202+
var searchInfo = searchTraces[k];
1203+
searchInfo._module.selectPoints(searchInfo, false);
1204+
}
1205+
1206+
updateSelectedState(gd, searchTraces);
1207+
}
11921208

11931209
if(sendEvents) {
11941210
if(eventData.points.length) {

0 commit comments

Comments
 (0)