Skip to content

Commit

Permalink
Add line select baseline
Browse files Browse the repository at this point in the history
  • Loading branch information
dy committed Feb 16, 2018
1 parent 42a7c77 commit 41c067a
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/traces/scattergl/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ function sceneUpdate(container, subplot) {
}

// draw traces in selection mode
if(scene.select2d && scene.selectBatch) {
if(scene.scatter2d && scene.select2d && scene.selectBatch) {
scene.select2d.draw(scene.selectBatch);
scene.scatter2d.draw(scene.unselectBatch);
}
Expand Down Expand Up @@ -947,12 +947,17 @@ function plot(container, subplot, cdata) {
scene.select2d = createScatter(layout._glcanvas.data()[1].regl, {clone: scene.scatter2d});
}

// update only traces with selection
scene.scatter2d.update(scene.unselectedOptions.map(function(opts, i) {
return scene.selectBatch[i] ? opts : null;
}));
scene.select2d.update(scene.markerOptions);
scene.select2d.update(scene.selectedOptions);
if(scene.scatter2d) {
// update only traces with selection
scene.scatter2d.update(scene.unselectedOptions.map(function(opts, i) {
return scene.selectBatch[i] ? opts : null;
}));
}

if(scene.select2d) {
scene.select2d.update(scene.markerOptions);
scene.select2d.update(scene.selectedOptions);
}
}

// uploat viewport/range data to GPU
Expand Down
14 changes: 14 additions & 0 deletions test/image/mocks/gl2d_line_select.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"data": [{
"type": "scattergl",
"mode": "lines",
"x": [1, 2, 3],
"y": [1, 2, 1]
}],
"layout": {
"dragmode": "select",
"showlegend": false,
"width": 400,
"height": 400
}
}

0 comments on commit 41c067a

Please sign in to comment.