From 95ecdce379ad46db9a5b96580739497633366979 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20T=C3=A9treault-Pinard?= Date: Fri, 26 Oct 2018 12:05:43 -0400 Subject: [PATCH 1/2] fix scatter fill restyle regression ... by setting trace._ownfill on every linkTraces call, so we don't let relinkPrivateKeys mess things up. Previously, the scatter fill restyle test did not fail, but did log a error as Drawing.fillGroupStyle logs in a try-catch when things go wrong instead of errorring out. --- src/traces/scatter/link_traces.js | 11 +++++------ test/jasmine/tests/scatter_test.js | 5 +++++ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/traces/scatter/link_traces.js b/src/traces/scatter/link_traces.js index ed50bd73d00..762d6f4355f 100644 --- a/src/traces/scatter/link_traces.js +++ b/src/traces/scatter/link_traces.js @@ -75,12 +75,11 @@ module.exports = function linkTraces(gd, plotinfo, cdscatter) { } } - if(trace.fill && ( - trace.fill.substr(0, 6) === 'tozero' || trace.fill === 'toself' || - (trace.fill.substr(0, 2) === 'to' && !trace._prevtrace)) - ) { - trace._ownfill = true; - } + trace._ownfill = (trace.fill && ( + trace.fill.substr(0, 6) === 'tozero' || + trace.fill === 'toself' || + (trace.fill.substr(0, 2) === 'to' && !trace._prevtrace) + )); prevtraces[group] = trace; } else { diff --git a/test/jasmine/tests/scatter_test.js b/test/jasmine/tests/scatter_test.js index cca7961e1c3..9dd5151c217 100644 --- a/test/jasmine/tests/scatter_test.js +++ b/test/jasmine/tests/scatter_test.js @@ -658,6 +658,10 @@ describe('end-to-end scatter tests', function() { // from any case to any other case. var indices = transitions(cases.length); + // Drawing.fillGroupStyle logs an error in a try-catch when + // things go wrong + spyOn(Lib, 'error'); + var p = Plotly.plot(gd, [ {y: [1, 2], text: 'a'}, {y: [2, 3], text: 'b'}, @@ -707,6 +711,7 @@ describe('end-to-end scatter tests', function() { var msg = i ? ('from ' + cases[indices[i - 1]].name + ' to ') : 'from default to '; msg += name; assertMultiNodeOrder(selectorArray, msg); + expect(Lib.error).not.toHaveBeenCalled(); }; } for(i = 0; i < indices.length; i++) { From 1f3c10c735927d57b78151be8c4d43bdf35e53d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20T=C3=A9treault-Pinard?= Date: Fri, 26 Oct 2018 12:24:14 -0400 Subject: [PATCH 2/2] rm try-catch (useless?) in Drawing.fillGroupStyle --- src/components/drawing/index.js | 8 +------- test/jasmine/tests/scatter_test.js | 5 ----- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/src/components/drawing/index.js b/src/components/drawing/index.js index 443f882d95c..e4b83300f67 100644 --- a/src/components/drawing/index.js +++ b/src/components/drawing/index.js @@ -198,13 +198,7 @@ drawing.fillGroupStyle = function(s) { s.style('stroke-width', 0) .each(function(d) { var shape = d3.select(this); - try { - shape.call(Color.fill, d[0].trace.fillcolor); - } - catch(e) { - Lib.error(e, s); - shape.remove(); - } + shape.call(Color.fill, d[0].trace.fillcolor); }); }; diff --git a/test/jasmine/tests/scatter_test.js b/test/jasmine/tests/scatter_test.js index 9dd5151c217..cca7961e1c3 100644 --- a/test/jasmine/tests/scatter_test.js +++ b/test/jasmine/tests/scatter_test.js @@ -658,10 +658,6 @@ describe('end-to-end scatter tests', function() { // from any case to any other case. var indices = transitions(cases.length); - // Drawing.fillGroupStyle logs an error in a try-catch when - // things go wrong - spyOn(Lib, 'error'); - var p = Plotly.plot(gd, [ {y: [1, 2], text: 'a'}, {y: [2, 3], text: 'b'}, @@ -711,7 +707,6 @@ describe('end-to-end scatter tests', function() { var msg = i ? ('from ' + cases[indices[i - 1]].name + ' to ') : 'from default to '; msg += name; assertMultiNodeOrder(selectorArray, msg); - expect(Lib.error).not.toHaveBeenCalled(); }; } for(i = 0; i < indices.length; i++) {