Skip to content

Commit

Permalink
cache repeated Math.min
Browse files Browse the repository at this point in the history
  • Loading branch information
kurkle committed Feb 7, 2019
1 parent 817970c commit 01b4c24
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/elements/element.rectangle.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,13 @@ module.exports = Element.extend({
right: Math.min(borderWidth.right || 0, maxWidth)
};
} else {
maxWidth = Math.min(borderWidth, maxWidth);
maxHeight = Math.min(borderWidth, maxHeight);
borderWidth = {
bottom: borderSkipped === 'bottom' ? 0 : Math.min(borderWidth, maxHeight),
left: borderSkipped === 'left' ? 0 : Math.min(borderWidth, maxWidth),
top: borderSkipped === 'top' ? 0 : Math.min(borderWidth, maxHeight),
right: borderSkipped === 'right' ? 0 : Math.min(borderWidth, maxWidth)
bottom: borderSkipped === 'bottom' ? 0 : maxHeight,
left: borderSkipped === 'left' ? 0 : maxWidth,
top: borderSkipped === 'top' ? 0 : maxHeight,
right: borderSkipped === 'right' ? 0 : maxWidth
};
}

Expand Down

0 comments on commit 01b4c24

Please sign in to comment.