Skip to content

Commit 9361a88

Browse files
authored
Merge pull request #6581 from dmyronuk/bugfix-scatter3d-marker-opacity
#6571 fix scatter3d marker opacity when marker.opacity is set to 0
2 parents 891d3b5 + 31f683b commit 9361a88

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

draftlogs/6581_fix.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
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!

src/traces/scatter3d/convert.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ proto.update = function(data) {
403403

404404
// N.B. marker.opacity must be a scalar for performance
405405
var scatterOpacity = data.opacity;
406-
if(data.marker && data.marker.opacity) scatterOpacity *= data.marker.opacity;
406+
if(data.marker && data.marker.opacity !== undefined) scatterOpacity *= data.marker.opacity;
407407

408408
scatterOptions = {
409409
gl: this.scene.glplot.gl,

test/jasmine/tests/scatter3d_test.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,4 +329,21 @@ describe('Test scatter3d interactions:', function() {
329329
})
330330
.then(done, done.fail);
331331
});
332+
333+
it('@gl markers should be transparent when marker.opacity is 0', function(done) {
334+
Plotly.newPlot(gd, [
335+
{
336+
type: 'scatter3d',
337+
x: [0],
338+
y: [0],
339+
z: [0],
340+
mode: 'markers',
341+
marker: { opacity: 0 }
342+
},
343+
])
344+
.then(function() {
345+
expect(gd._fullLayout.scene._scene.glplot.objects[0].opacity).toEqual(0);
346+
})
347+
.then(done, done.fail);
348+
});
332349
});

0 commit comments

Comments
 (0)