Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c104ed7

Browse files
committed
fix: scatter3d marker opacity when marker.opacity is set to 0
1 parent 3f533b2 commit c104ed7

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

src/traces/scatter3d/convert.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
'use strict';
22

3+
var isNumeric = require('fast-isnumeric');
4+
35
var createLinePlot = require('../../../stackgl_modules').gl_line3d;
46
var createScatterPlot = require('../../../stackgl_modules').gl_scatter3d;
57
var createErrorBars = require('../../../stackgl_modules').gl_error3d;
@@ -403,7 +405,7 @@ proto.update = function(data) {
403405

404406
// N.B. marker.opacity must be a scalar for performance
405407
var scatterOpacity = data.opacity;
406-
if(data.marker && data.marker.opacity) scatterOpacity *= data.marker.opacity;
408+
if(data.marker && isNumeric(data.marker.opacity)) scatterOpacity *= data.marker.opacity;
407409

408410
scatterOptions = {
409411
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)