Skip to content

Commit 2b1fc2c

Browse files
committed
relayout on resize only when layout.autosize is true. fixes #403
1 parent f9c671f commit 2b1fc2c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

inst/htmlwidgets/plotly.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ HTMLWidgets.widget({
88
},
99

1010
resize: function(el, width, height, instance) {
11-
Plotly.relayout(el.id, {width: width, height: height});
11+
if (instance.autosize) {
12+
Plotly.relayout(el.id, {width: width, height: height});
13+
}
1214
},
1315

1416
renderValue: function(el, x, instance) {
@@ -27,6 +29,7 @@ HTMLWidgets.widget({
2729
if (!instance.plotly) {
2830
Plotly.plot(graphDiv, x.data, x.layout, x.config);
2931
instance.plotly = true;
32+
instance.autosize = x.layout.autosize;
3033
} else {
3134
Plotly.newPlot(graphDiv, x.data, x.layout);
3235
}

0 commit comments

Comments
 (0)