8000 fix(useElementSize): use getBoundingClientRect get element size on SV… · vueuse/vueuse@d80150b · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Commit d80150b

Browse files
authored
fix(useElementSize): use getBoundingClientRect get element size on SVG (#3940)
1 parent fba4e77 commit d80150b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/core/useElementSize/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ export function useElementSize(
3838
if (window && isSVG.value) {
3939
const $elem = unrefElement(target)
4040
if ($elem) {
41-
const styles = window.getComputedStyle($elem)
42-
width.value = Number.parseFloat(styles.width)
43-
height.value = Number.parseFloat(styles.height)
41+
const rect = $elem.getBoundingClientRect()
42+
width.value = rect.width
43+
height.value = rect.height
4444
}
4545
}
4646
else {

0 commit comments

Comments
 (0)
0