Skip to content

Commit 6e4db26

Browse files
authoredOct 4, 2021
Merge pull request #5958 from dwoznicki/fix-scatter3d-opacity-restyle
Fix scatter3d opacity restyle bug
2 parents 99e674a + f1502a4 commit 6e4db26

File tree

4 files changed

+25
-1
lines changed

4 files changed

+25
-1
lines changed
 

Diff for: ‎draftlogs/5958_fix.md

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- Fix scatter3d opacity restyle bug [[#5958](https://github.com/plotly/plotly.js/pull/5958)],
2+
with thanks to @dwoznicki for the contribution!

Diff for: ‎src/traces/scatter3d/attributes.js

+2
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,8 @@ var attrs = module.exports = overrideAll({
161161
family: extendFlat({}, scatterAttrs.textfont.family, {arrayOk: false})
162162
},
163163

164+
opacity: baseAttrs.opacity,
165+
164166
hoverinfo: extendFlat({}, baseAttrs.hoverinfo)
165167
}, 'calc', 'nested');
166168

Diff for: ‎test/jasmine/tests/scatter3d_test.js

+20
Original file line numberDiff line numberDiff line change
@@ -309,4 +309,24 @@ describe('Test scatter3d interactions:', function() {
309309
})
310310
.then(done, done.fail);
311311
});
312+
313+
it('@gl should change marker opacity when restyle is called', function(done) {
314+
Plotly.newPlot(
315+
gd,
316+
[
317+
{
318+
type: 'scatter3d',
319+
x: [0],
320+
y: [0],
321+
z: [0],
322+
mode: 'markers',
323+
},
324+
]
325+
).then(function() {
326+
Plotly.restyle(gd, 'opacity', 0.5).then(function() {
327+
expect(gd._fullLayout.scene._scene.glplot.objects[0].hasAlpha).toEqual(true);
328+
});
329+
})
330+
.then(done, done.fail);
331+
});
312332
});

Diff for: ‎test/plot-schema.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -44927,7 +44927,7 @@
4492744927
"opacity": {
4492844928
"description": "Sets the opacity of the trace.",
4492944929
"dflt": 1,
44930-
"editType": "style",
44930+
"editType": "calc",
4493144931
"max": 1,
4493244932
"min": 0,
4493344933
"valType": "number"

0 commit comments

Comments
 (0)
Please sign in to comment.