Skip to content

Commit e03d686

Browse files
authored
Merge pull request #3174 from plotly/issue-1976
Fix for issue 1976 - remove webgl warnings for empty lines when using gl-line3d
2 parents 0d0f303 + b0e1c1b commit e03d686

File tree

3 files changed

+31
-4
lines changed

3 files changed

+31
-4
lines changed

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
"gl-contour2d": "^1.1.4",
7575
"gl-error3d": "^1.0.8",
7676
"gl-heatmap2d": "^1.0.4",
77-
"gl-line3d": "^1.1.4",
77+
"gl-line3d": "^1.1.5",
7878
"gl-mat4": "^1.2.0",
7979
"gl-mesh3d": "^2.0.1",
8080
"gl-plot2d": "^1.3.1",

test/jasmine/tests/gl3d_plot_interact_test.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,33 @@ describe('Test gl3d plots', function() {
531531
.then(done);
532532
});
533533

534+
it('@gl should avoid passing empty lines to webgl', function(done) {
535+
var obj;
536+
537+
Plotly.plot(gd, [{
538+
type: 'scatter3d',
539+
mode: 'lines',
540+
x: [1],
541+
y: [2],
542+
z: [3]
543+
}])
544+
.then(function() {
545+
obj = gd._fullLayout.scene._scene.glplot.objects[0];
546+
spyOn(obj.vao, 'draw').and.callThrough();
547+
548+
expect(obj.vertexCount).toBe(0, '# of vertices');
549+
550+
return Plotly.restyle(gd, 'line.color', 'red');
551+
})
552+
.then(function() {
553+
expect(obj.vertexCount).toBe(0, '# of vertices');
554+
// calling this with no vertex causes WebGL warnings,
555+
// see https://github.com/plotly/plotly.js/issues/1976
556+
expect(obj.vao.draw).toHaveBeenCalledTimes(0);
557+
})
558+
.catch(failTest)
559+
.then(done);
560+
});
534561
});
535562

536563
describe('Test gl3d modebar handlers', function() {

0 commit comments

Comments
 (0)