Skip to content

Commit

Permalink
fix(useElementSize): use getBoundingClientRect get element size on SVG (
Browse files Browse the repository at this point in the history
  • Loading branch information
siaikin committed May 27, 2024
1 parent fba4e77 commit d80150b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/core/useElementSize/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ export function useElementSize(
if (window && isSVG.value) {
const $elem = unrefElement(target)
if ($elem) {
const styles = window.getComputedStyle($elem)
width.value = Number.parseFloat(styles.width)
height.value = Number.parseFloat(styles.height)
const rect = $elem.getBoundingClientRect()
width.value = rect.width
height.value = rect.height
}
}
else {
Expand Down

0 comments on commit d80150b

Please sign in to comment.