diff --git a/draftlogs/6581_fix.md b/draftlogs/6581_fix.md new file mode 100644 index 00000000000..16b9d199452 --- /dev/null +++ b/draftlogs/6581_fix.md @@ -0,0 +1 @@ + - fix scatter3d when `marker.opacity` is set to zero [[#6581](https://github.com/plotly/plotly.js/pull/6581)], with thanks to @dmyronuk for the contribution! \ No newline at end of file diff --git a/src/traces/scatter3d/convert.js b/src/traces/scatter3d/convert.js index e186b1949f6..bea698d1e68 100644 --- a/src/traces/scatter3d/convert.js +++ b/src/traces/scatter3d/convert.js @@ -403,7 +403,7 @@ proto.update = function(data) { // N.B. marker.opacity must be a scalar for performance var scatterOpacity = data.opacity; - if(data.marker && data.marker.opacity) scatterOpacity *= data.marker.opacity; + if(data.marker && data.marker.opacity !== undefined) scatterOpacity *= data.marker.opacity; scatterOptions = { gl: this.scene.glplot.gl, diff --git a/test/jasmine/tests/scatter3d_test.js b/test/jasmine/tests/scatter3d_test.js index bbe0a644550..ea6916ae435 100644 --- a/test/jasmine/tests/scatter3d_test.js +++ b/test/jasmine/tests/scatter3d_test.js @@ -329,4 +329,21 @@ describe('Test scatter3d interactions:', function() { }) .then(done, done.fail); }); + + it('@gl markers should be transparent when marker.opacity is 0', function(done) { + Plotly.newPlot(gd, [ + { + type: 'scatter3d', + x: [0], + y: [0], + z: [0], + mode: 'markers', + marker: { opacity: 0 } + }, + ]) + .then(function() { + expect(gd._fullLayout.scene._scene.glplot.objects[0].opacity).toEqual(0); + }) + .then(done, done.fail); + }); });