Skip to content

Reflect scatter3d marker opacity reality in attributes #114

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 2 commits into from
Dec 17, 2015
Merged
Show file tree
Hide file tree
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: 1 addition & 1 deletion devtools/test_dashboard/test_gl3d.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ plots['triangle-mesh3d'] = require('@mocks/gl3d_triangle.json');
plots['snowden'] = require('@mocks/gl3d_snowden.json');
plots['bunny'] = require('@mocks/gl3d_bunny.json');
plots['ribbons'] = require('@mocks/gl3d_ribbons.json');
plots['date-time'] = require('@mocks/gl3d_scatter-date.json');
plots['scatter-time'] = require('@mocks/gl3d_scatter-date.json');
plots['cufflinks'] = require('@mocks/gl3d_cufflinks.json');
plots['chrisp-nan-1'] = require('@mocks/gl3d_chrisp-nan-1.json');
plots['marker-arrays'] = require('@mocks/gl3d_marker-arrays.json');
Expand Down
12 changes: 11 additions & 1 deletion src/traces/scatter3d/attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,17 @@ module.exports = {
sizeref: scatterMarkerAttrs.sizeref,
sizemin: scatterMarkerAttrs.sizemin,
sizemode: scatterMarkerAttrs.sizemode,
opacity: scatterMarkerAttrs.opacity,
opacity: extendFlat({}, scatterMarkerAttrs.opacity, {
arrayOk: false,
description: [
'Sets the marker opacity.',
'Note that the marker opacity for scatter3d traces',
'must be a scalar value for performance reasons.',
'To set a blending opacity value',
'(i.e. which is not transparent), set *marker.color*',
'to an rgba color and use its alpha channel.'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cldougl I could use a proof reader.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice- looks great to me!

].join(' ')
}),
colorscale: scatterMarkerAttrs.colorscale,
cauto: scatterMarkerAttrs.cauto,
cmax: scatterMarkerAttrs.cmax,
Expand Down
5 changes: 2 additions & 3 deletions src/traces/scatter3d/convert.js
Original file line number Diff line number Diff line change
Expand Up @@ -319,10 +319,9 @@ proto.update = function(data) {
this.linePlot = null;
}

// N.B. marker.opacity must be a scalar for performance
var scatterOpacity = data.opacity;
if(data.marker && typeof data.marker.opacity === 'number') {
scatterOpacity *= data.marker.opacity;
}
if(data.marker && data.marker.opacity) scatterOpacity *= data.marker.opacity;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now data.marker.opacity will always be a scalar after the coerce step.


scatterOptions = {
gl: gl,
Expand Down