@visactor/vutils
Advanced tools
Comparing version 0.16.19 to 0.16.20
@@ -14,6 +14,13 @@ "use strict"; | ||
} | ||
const style = getComputedStyle(el), computedWidth = parseFloat(style.width) - parseFloat(style.paddingLeft) - parseFloat(style.paddingRight) || el.clientWidth - 1, computedHeight = parseFloat(style.height) - parseFloat(style.paddingTop) - parseFloat(style.paddingBottom) || el.clientHeight - 1; | ||
const style = getComputedStyle(el); | ||
if (/^(\d*\.?\d+)(px)$/.exec(style.width)) { | ||
const computedWidth = parseFloat(style.width) - parseFloat(style.paddingLeft) - parseFloat(style.paddingRight) || el.clientWidth - 1, computedHeight = parseFloat(style.height) - parseFloat(style.paddingTop) - parseFloat(style.paddingBottom) || el.clientHeight - 1; | ||
return { | ||
width: computedWidth <= 0 ? defaultWidth : computedWidth, | ||
height: computedHeight <= 0 ? defaultHeight : computedHeight | ||
}; | ||
} | ||
return { | ||
width: computedWidth <= 0 ? defaultWidth : computedWidth, | ||
height: computedHeight <= 0 ? defaultHeight : computedHeight | ||
width: defaultWidth, | ||
height: defaultHeight | ||
}; | ||
@@ -20,0 +27,0 @@ } |
@@ -12,6 +12,13 @@ export function getContainerSize(el, defaultWidth = 0, defaultHeight = 0) { | ||
} | ||
const style = getComputedStyle(el), computedWidth = parseFloat(style.width) - parseFloat(style.paddingLeft) - parseFloat(style.paddingRight) || el.clientWidth - 1, computedHeight = parseFloat(style.height) - parseFloat(style.paddingTop) - parseFloat(style.paddingBottom) || el.clientHeight - 1; | ||
const style = getComputedStyle(el); | ||
if (/^(\d*\.?\d+)(px)$/.exec(style.width)) { | ||
const computedWidth = parseFloat(style.width) - parseFloat(style.paddingLeft) - parseFloat(style.paddingRight) || el.clientWidth - 1, computedHeight = parseFloat(style.height) - parseFloat(style.paddingTop) - parseFloat(style.paddingBottom) || el.clientHeight - 1; | ||
return { | ||
width: computedWidth <= 0 ? defaultWidth : computedWidth, | ||
height: computedHeight <= 0 ? defaultHeight : computedHeight | ||
}; | ||
} | ||
return { | ||
width: computedWidth <= 0 ? defaultWidth : computedWidth, | ||
height: computedHeight <= 0 ? defaultHeight : computedHeight | ||
width: defaultWidth, | ||
height: defaultHeight | ||
}; | ||
@@ -18,0 +25,0 @@ } |
{ | ||
"name": "@visactor/vutils", | ||
"version": "0.16.19", | ||
"version": "0.16.20", | ||
"main": "cjs/index.js", | ||
@@ -30,6 +30,6 @@ "module": "es/index.js", | ||
"@types/node": "*", | ||
"@internal/eslint-config": "0.0.1", | ||
"@internal/ts-config": "0.0.1", | ||
"@internal/jest-config": "0.0.1", | ||
"@internal/ts-config": "0.0.1", | ||
"@internal/bundler": "0.0.1" | ||
"@internal/bundler": "0.0.1", | ||
"@internal/eslint-config": "0.0.1" | ||
}, | ||
@@ -36,0 +36,0 @@ "dependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1418391
13993
37