Skip to content

Commit

Permalink
Better minification (and certainly performance)
Browse files Browse the repository at this point in the history
  • Loading branch information
kurkle committed Jan 29, 2019
1 parent 5362045 commit 0345c93
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/core/core.layouts.js
Expand Up @@ -27,17 +27,25 @@ function sortByWeight(array, reverse) {
}

function findMaxPadding(boxes) {
var maxPadding = {top: 0, left: 0, bottom: 0, right: 0};
var top = 0;
var left = 0;
var bottom = 0;
var right = 0;
helpers.each(boxes, function(box) {
if (box.getPadding) {
var boxPadding = box.getPadding();
maxPadding.left = Math.max(maxPadding.left, boxPadding.left);
maxPadding.right = Math.max(maxPadding.right, boxPadding.right);
maxPadding.top = Math.max(maxPadding.top, boxPadding.top);
maxPadding.bottom = Math.max(maxPadding.bottom, boxPadding.bottom);
top = Math.max(top, boxPadding.top);
left = Math.max(left, boxPadding.left);
bottom = Math.max(bottom, boxPadding.bottom);
right = Math.max(right, boxPadding.right);
}
});
return maxPadding;
return {
top: top,
left: left,
bottom: bottom,
right: right
};
}

function addSizeByPosition(boxes, size) {
Expand Down

0 comments on commit 0345c93

Please sign in to comment.