From 80789457695f49345219fbd57d799ce1708298f2 Mon Sep 17 00:00:00 2001 From: dwoznicki Date: Wed, 29 Sep 2021 16:55:23 -0700 Subject: [PATCH 1/4] Fixed a bug where calling `Plotly.restyle` to change the opacity of a scatter3d trace was not updating the graph --- src/traces/scatter3d/attributes.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/traces/scatter3d/attributes.js b/src/traces/scatter3d/attributes.js index db091c6bacd..b6c1315a9ab 100644 --- a/src/traces/scatter3d/attributes.js +++ b/src/traces/scatter3d/attributes.js @@ -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'); From 06521587b56346271fbf5a02b98c7fc93b2d2325 Mon Sep 17 00:00:00 2001 From: dwoznicki Date: Thu, 30 Sep 2021 10:46:37 -0700 Subject: [PATCH 2/4] update plot-schema diff --- test/plot-schema.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/plot-schema.json b/test/plot-schema.json index 5cb02325f61..42d2478c731 100644 --- a/test/plot-schema.json +++ b/test/plot-schema.json @@ -44927,7 +44927,7 @@ "opacity": { "description": "Sets the opacity of the trace.", "dflt": 1, - "editType": "style", + "editType": "calc", "max": 1, "min": 0, "valType": "number" From 1a11fd85988087efeba41d3c9104c2da7c4b9238 Mon Sep 17 00:00:00 2001 From: dwoznicki Date: Mon, 4 Oct 2021 11:40:39 -0700 Subject: [PATCH 3/4] Added test to check that marker opacity changes when restyle is called --- test/jasmine/tests/scatter3d_test.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/jasmine/tests/scatter3d_test.js b/test/jasmine/tests/scatter3d_test.js index 577492252fa..a9704e331c6 100644 --- a/test/jasmine/tests/scatter3d_test.js +++ b/test/jasmine/tests/scatter3d_test.js @@ -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); + }); }); From f1502a4e4cd86a0a2960099aa1593b683a5e4e06 Mon Sep 17 00:00:00 2001 From: dwoznicki Date: Mon, 4 Oct 2021 11:42:45 -0700 Subject: [PATCH 4/4] Added draftlog --- draftlogs/5958_fix.md | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 draftlogs/5958_fix.md diff --git a/draftlogs/5958_fix.md b/draftlogs/5958_fix.md new file mode 100644 index 00000000000..62ebeabb177 --- /dev/null +++ b/draftlogs/5958_fix.md @@ -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!