From 2b1fc2c00023b3d2a523305705779d75fe66a0e9 Mon Sep 17 00:00:00 2001 From: cpsievert Date: Mon, 14 Mar 2016 10:36:16 +1100 Subject: [PATCH 1/2] relayout on resize only when layout.autosize is true. fixes #403 --- inst/htmlwidgets/plotly.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/inst/htmlwidgets/plotly.js b/inst/htmlwidgets/plotly.js index f974afeaf9..8dbf13fd8b 100644 --- a/inst/htmlwidgets/plotly.js +++ b/inst/htmlwidgets/plotly.js @@ -8,7 +8,9 @@ HTMLWidgets.widget({ }, resize: function(el, width, height, instance) { - Plotly.relayout(el.id, {width: width, height: height}); + if (instance.autosize) { + Plotly.relayout(el.id, {width: width, height: height}); + } }, renderValue: function(el, x, instance) { @@ -27,6 +29,7 @@ HTMLWidgets.widget({ if (!instance.plotly) { Plotly.plot(graphDiv, x.data, x.layout, x.config); instance.plotly = true; + instance.autosize = x.layout.autosize; } else { Plotly.newPlot(graphDiv, x.data, x.layout); } From 48713588c9fbfea7679eca6ea03dc98c8fd77dd7 Mon Sep 17 00:00:00 2001 From: cpsievert Date: Mon, 14 Mar 2016 10:51:35 +1100 Subject: [PATCH 2/2] bump version; update news --- DESCRIPTION | 2 +- NEWS | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index f997d8bb1f..e0baff8b7e 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: plotly Title: Create Interactive Web Graphics via 'plotly.js' -Version: 3.4.1 +Version: 3.4.2 Authors@R: c(person("Carson", "Sievert", role = c("aut", "cre"), email = "cpsievert1@gmail.com"), person("Chris", "Parmer", role = c("aut", "cph"), diff --git a/NEWS b/NEWS index 3c6256deb5..53264f9bac 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,10 @@ +3.4.2 -- 14 Mar 2016 + +BUGFIX: + +Automatic resizing will now occur only when layout.autosize is true (the default). See #403. + + 3.4.1 -- 13 Mar 2016 BUGFIX: