Skip to content

Fix scatter3d opacity restyle bug #5958

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 4, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions draftlogs/5958_fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Fix scatter3d opacity restyle bug [[#5958](https://github.com/plotly/plotly.js/pull/5958)],
with thanks to @dwoznicki for the contribution!
2 changes: 2 additions & 0 deletions src/traces/scatter3d/attributes.js
Original file line number Diff line number Diff line change
@@ -161,6 +161,8 @@ var attrs = module.exports = overrideAll({
family: extendFlat({}, scatterAttrs.textfont.family, {arrayOk: false})
},

opacity: baseAttrs.opacity,

hoverinfo: extendFlat({}, baseAttrs.hoverinfo)
}, 'calc', 'nested');

20 changes: 20 additions & 0 deletions test/jasmine/tests/scatter3d_test.js
Original file line number Diff line number Diff line change
@@ -309,4 +309,24 @@ describe('Test scatter3d interactions:', function() {
})
.then(done, done.fail);
});

it('@gl should change marker opacity when restyle is called', function(done) {
Plotly.newPlot(
gd,
[
{
type: 'scatter3d',
x: [0],
y: [0],
z: [0],
mode: 'markers',
},
]
).then(function() {
Plotly.restyle(gd, 'opacity', 0.5).then(function() {
expect(gd._fullLayout.scene._scene.glplot.objects[0].hasAlpha).toEqual(true);
});
})
.then(done, done.fail);
});
});
2 changes: 1 addition & 1 deletion test/plot-schema.json
Original file line number Diff line number Diff line change
@@ -44927,7 +44927,7 @@
"opacity": {
"description": "Sets the opacity of the trace.",
"dflt": 1,
"editType": "style",
"editType": "calc",
"max": 1,
"min": 0,
"valType": "number"