Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e822ff7

Browse files
committed
autosize: ensure sanitizeMargins is called once
1 parent 6021c43 commit e822ff7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/plots/plots.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -493,10 +493,11 @@ plots.supplyDefaults = function(gd) {
493493
plots.supplyLayoutGlobalDefaults(newLayout, newFullLayout);
494494

495495
var missingWidthOrHeight = (!newLayout.width || !newLayout.height),
496-
autosize = newLayout.autosize,
496+
autosize = newFullLayout.autosize,
497497
autosizable = gd._context && gd._context.autosizable,
498498
initialAutoSize = missingWidthOrHeight && (autosize || autosizable);
499499
if(initialAutoSize) plots.plotAutoSize(gd, newLayout, newFullLayout);
500+
else if(missingWidthOrHeight) plots.sanitizeMargins(gd);
500501

501502
// for backwards-compatibility with Plotly v1.x.x
502503
if(!autosize && missingWidthOrHeight) {
@@ -778,7 +779,6 @@ plots.supplyLayoutGlobalDefaults = function(layoutIn, layoutOut) {
778779
coerce('margin.pad');
779780
coerce('margin.autoexpand');
780781

781-
// called in plotAutoSize otherwise
782782
if(layoutIn.width && layoutIn.height) plots.sanitizeMargins(layoutOut);
783783

784784
coerce('paper_bgcolor');
@@ -847,9 +847,9 @@ plots.plotAutoSize = function plotAutoSize(gd, layout, fullLayout) {
847847
if(heightHasChanged || widthHasChanged) {
848848
if(widthHasChanged) fullLayout.width = newWidth;
849849
if(heightHasChanged) fullLayout.height = newHeight;
850-
851-
plots.sanitizeMargins(fullLayout);
852850
}
851+
852+
plots.sanitizeMargins(fullLayout);
853853
};
854854

855855
/**

0 commit comments

Comments
 (0)