Skip to content

Commit 41c067a

Browse files
committed
Add line select baseline
1 parent 42a7c77 commit 41c067a

File tree

2 files changed

+26
-7
lines changed

2 files changed

+26
-7
lines changed

src/traces/scattergl/index.js

+12-7
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ function sceneUpdate(container, subplot) {
591591
}
592592

593593
// draw traces in selection mode
594-
if(scene.select2d && scene.selectBatch) {
594+
if(scene.scatter2d && scene.select2d && scene.selectBatch) {
595595
scene.select2d.draw(scene.selectBatch);
596596
scene.scatter2d.draw(scene.unselectBatch);
597597
}
@@ -947,12 +947,17 @@ function plot(container, subplot, cdata) {
947947
scene.select2d = createScatter(layout._glcanvas.data()[1].regl, {clone: scene.scatter2d});
948948
}
949949

950-
// update only traces with selection
951-
scene.scatter2d.update(scene.unselectedOptions.map(function(opts, i) {
952-
return scene.selectBatch[i] ? opts : null;
953-
}));
954-
scene.select2d.update(scene.markerOptions);
955-
scene.select2d.update(scene.selectedOptions);
950+
if(scene.scatter2d) {
951+
// update only traces with selection
952+
scene.scatter2d.update(scene.unselectedOptions.map(function(opts, i) {
953+
return scene.selectBatch[i] ? opts : null;
954+
}));
955+
}
956+
957+
if(scene.select2d) {
958+
scene.select2d.update(scene.markerOptions);
959+
scene.select2d.update(scene.selectedOptions);
960+
}
956961
}
957962

958963
// uploat viewport/range data to GPU
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"data": [{
3+
"type": "scattergl",
4+
"mode": "lines",
5+
"x": [1, 2, 3],
6+
"y": [1, 2, 1]
7+
}],
8+
"layout": {
9+
"dragmode": "select",
10+
"showlegend": false,
11+
"width": 400,
12+
"height": 400
13+
}
14+
}

0 commit comments

Comments
 (0)