Skip to content

Commit e763964

Browse files
committed
Add click-to-select support to splom [1852]
1 parent 5b08a2c commit e763964

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/traces/splom/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,9 @@ function plotOne(gd, cd0) {
221221
scene.matrix = createMatrix(regl);
222222
}
223223

224-
var selectMode = dragmode === 'lasso' || dragmode === 'select' || !!trace.selectedpoints;
224+
var clickSelectEnabled = fullLayout.clickmode.indexOf('select') > -1;
225+
var selectMode = dragmode === 'lasso' || dragmode === 'select' ||
226+
!!trace.selectedpoints || clickSelectEnabled;
225227
scene.selectBatch = null;
226228
scene.unselectBatch = null;
227229

@@ -372,7 +374,7 @@ function selectPoints(searchInfo, polygon) {
372374
if(polygon !== false && !polygon.degenerate) {
373375
els = [], unels = [];
374376
for(i = 0; i < x.length; i++) {
375-
if(polygon.contains([xpx[i], ypx[i]])) {
377+
if(polygon.contains([xpx[i], ypx[i]], null, i, searchInfo)) {
376378
els.push(i);
377379
selection.push({
378380
pointNumber: i,

test/jasmine/tests/select_test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,8 @@ describe('@flaky Click-to-select', function() {
630630
testCase('scatterpolar', require('@mocks/polar_scatter.json'), 130, 290,
631631
[[], [], [], [19], [], []], { dragmode: 'zoom' }),
632632
testCase('scatterpolargl', require('@mocks/glpolar_scatter.json'), 130, 290,
633-
[[], [], [], [19], [], []], { dragmode: 'zoom' })
633+
[[], [], [], [19], [], []], { dragmode: 'zoom' }),
634+
testCase('splom', require('@mocks/splom_lower.json'), 427, 400, [[], [7], []])
634635
]
635636
.forEach(function(testCase) {
636637
it('trace type ' + testCase.traceType, function(done) {

0 commit comments

Comments
 (0)