Skip to content

Commit f3ab980

Browse files
committed
refactor - write as a constant
1 parent f1597db commit f3ab980

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/plots/plots.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1866,8 +1866,8 @@ function initMargins(fullLayout) {
18661866
if(!fullLayout._pushmarginIds) fullLayout._pushmarginIds = {};
18671867
}
18681868

1869-
var minFinalWidth = 64; // could possibly be exposed as layout.margin.minfinalwidth
1870-
var minFinalHeight = 16; // could possibly be exposed as layout.margin.minfinalheight
1869+
var MIN_FINAL_WIDTH = 64; // could possibly be exposed as layout.margin.minfinalwidth
1870+
var MIN_FINAL_HEIGHT = 16; // could possibly be exposed as layout.margin.minfinalheight
18711871

18721872
/**
18731873
* autoMargin: called by components that may need to expand the margins to
@@ -1888,8 +1888,9 @@ plots.autoMargin = function(gd, id, o) {
18881888
var fullLayout = gd._fullLayout;
18891889
var width = fullLayout.width;
18901890
var height = fullLayout.height;
1891-
var maxSpaceW = Math.max(0, width - minFinalWidth);
1892-
var maxSpaceH = Math.max(0, height - minFinalHeight);
1891+
1892+
var maxSpaceW = Math.max(0, width - MIN_FINAL_WIDTH);
1893+
var maxSpaceH = Math.max(0, height - MIN_FINAL_HEIGHT);
18931894

18941895
var pushMargin = fullLayout._pushmargin;
18951896
var pushMarginIds = fullLayout._pushmarginIds;
@@ -1944,8 +1945,8 @@ plots.doAutoMargin = function(gd) {
19441945
var fullLayout = gd._fullLayout;
19451946
var width = fullLayout.width;
19461947
var height = fullLayout.height;
1947-
var maxSpaceW = Math.max(0, width - minFinalWidth);
1948-
var maxSpaceH = Math.max(0, height - minFinalHeight);
1948+
var maxSpaceW = Math.max(0, width - MIN_FINAL_WIDTH);
1949+
var maxSpaceH = Math.max(0, height - MIN_FINAL_HEIGHT);
19491950

19501951
if(!fullLayout._size) fullLayout._size = {};
19511952
initMargins(fullLayout);

0 commit comments

Comments
 (0)