diff --git a/src/utils.js b/src/utils.js index b2c96f9..2742a7b 100644 --- a/src/utils.js +++ b/src/utils.js @@ -458,8 +458,8 @@ function getWH(elem, name, ex) { const which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom']; let borderBoxValue = name === 'width' - ? Math.floor(elem.getBoundingClientRect().width) - : Math.floor(elem.getBoundingClientRect().height); + ? Math.ceil(elem.getBoundingClientRect().width) + : Math.ceil(elem.getBoundingClientRect().height); const isBorderBox = isBorderBoxFn(elem); let cssBoxValue = 0; if ( @@ -478,7 +478,7 @@ function getWH(elem, name, ex) { cssBoxValue = elem.style[name] || 0; } // Normalize '', auto, and prepare for extra - cssBoxValue = Math.floor(parseFloat(cssBoxValue)) || 0; + cssBoxValue = Math.ceil(parseFloat(cssBoxValue)) || 0; } if (extra === undefined) { extra = isBorderBox ? BORDER_INDEX : CONTENT_INDEX;