@@ -108,7 +108,7 @@ function prepSelect(e, startX, startY, dragOptions, mode) {
108
108
var throttleID = fullLayout . _uid + constants . SELECTID ;
109
109
110
110
// find the traces to search for selection points
111
- var searchTraces = determineSearchTraces ( gd , dragOptions . xaxes , dragOptions . yaxes ) ;
111
+ var searchTraces = determineSearchTraces ( gd , dragOptions . xaxes , dragOptions . yaxes , dragOptions . subplot ) ;
112
112
113
113
function axValue ( ax ) {
114
114
var index = ( ax . _id . charAt ( 0 ) === 'y' ) ? 1 : 0 ;
@@ -292,7 +292,7 @@ function prepSelect(e, startX, startY, dragOptions, mode) {
292
292
}
293
293
else {
294
294
// TODO What to do with the code below because we now have behavior for a single click
295
- selectOnClick ( gd , numClicks , evt , dragOptions . xaxes , dragOptions . yaxes , outlines ) ;
295
+ selectOnClick ( gd , numClicks , evt , dragOptions . xaxes , dragOptions . yaxes , outlines , dragOptions . subplot ) ;
296
296
297
297
// TODO: remove in v2 - this was probably never intended to work as it does,
298
298
// but in case anyone depends on it we don't want to break it now.
@@ -327,7 +327,7 @@ function prepSelect(e, startX, startY, dragOptions, mode) {
327
327
// ----------------
328
328
// TODO handle clearing selection when no point is clicked (based on hoverData)
329
329
// TODO remove console.log statements
330
- function selectOnClick ( gd , numClicks , evt , xAxes , yAxes , outlines ) {
330
+ function selectOnClick ( gd , numClicks , evt , xAxes , yAxes , outlines , subplot ) {
331
331
var hoverData = gd . _hoverdata ;
332
332
var retainSelection = shouldRetainSelection ( evt ) ;
333
333
var searchTraces ;
@@ -346,7 +346,7 @@ function selectOnClick(gd, numClicks, evt, xAxes, yAxes, outlines) {
346
346
if ( numClicks === 1 && isHoverDataSet ( hoverData ) ) {
347
347
allSelectionItems = [ ] ;
348
348
349
- searchTraces = determineSearchTraces ( gd , xAxes , yAxes ) ;
349
+ searchTraces = determineSearchTraces ( gd , xAxes , yAxes , subplot ) ;
350
350
clearEntireSelection = entireSelectionToBeCleared ( searchTraces , hoverData ) ;
351
351
352
352
for ( i = 0 ; i < searchTraces . length ; i ++ ) {
@@ -450,7 +450,7 @@ function selectOnClick(gd, numClicks, evt, xAxes, yAxes, outlines) {
450
450
}
451
451
}
452
452
453
- function determineSearchTraces ( gd , xAxes , yAxes ) {
453
+ function determineSearchTraces ( gd , xAxes , yAxes , subplot ) {
454
454
var searchTraces = [ ] ;
455
455
var xAxisIds = xAxes . map ( getAxId ) ;
456
456
var yAxisIds = yAxes . map ( getAxId ) ;
@@ -464,21 +464,9 @@ function determineSearchTraces(gd, xAxes, yAxes) {
464
464
465
465
if ( trace . visible !== true || ! trace . _module || ! trace . _module . selectable ) continue ;
466
466
467
- // TODO is dragOptions.subplot is ever set? If not, delete.
468
- // if(dragOptions.subplot) {
469
- // if(
470
- // trace.subplot === dragOptions.subplot ||
471
- // trace.geo === dragOptions.subplot
472
- // ) {
473
- // searchTraces.push({
474
- // _module: trace._module,
475
- // cd: cd,
476
- // xaxis: xAxes[0],
477
- // yaxis: yAxes[0]
478
- // });
479
- // }
480
- // } else if(
481
- if (
467
+ if ( subplot && ( trace . subplot === subplot || trace . geo === subplot ) ) {
468
+ searchTraces . push ( createSearchInfo ( trace . _module , cd , xAxes [ 0 ] , yAxes [ 0 ] ) ) ;
469
+ } else if (
482
470
trace . type === 'splom' &&
483
471
// FIXME: make sure we don't have more than single axis for splom
484
472
trace . _xaxes [ xAxisIds [ 0 ] ] && trace . _yaxes [ yAxisIds [ 0 ] ]
0 commit comments