Skip to content

Commit

Permalink
Merge pull request #6581 from dmyronuk/bugfix-scatter3d-marker-opacity
Browse files Browse the repository at this point in the history
#6571 fix scatter3d marker opacity when marker.opacity is set to 0
  • Loading branch information
archmoj authored Apr 26, 2023
2 parents 891d3b5 + 31f683b commit 9361a88
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions draftlogs/6581_fix.md
Original file line number Diff line number Diff line change
@@ -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!
2 changes: 1 addition & 1 deletion src/traces/scatter3d/convert.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
17 changes: 17 additions & 0 deletions test/jasmine/tests/scatter3d_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
});

0 comments on commit 9361a88

Please sign in to comment.