Skip to content

Commit

Permalink
Adding comment
Browse files Browse the repository at this point in the history
  • Loading branch information
mattgperry authored and mergatron[bot] committed Aug 30, 2023
1 parent d26a7aa commit 54b956b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/framer-motion/src/render/dom/scroll/offsets/inset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ export function calcInset(element: Element, container: HTMLElement) {
inset.y += current.offsetTop
current = current.offsetParent
} else if (current.tagName === "svg") {
/**
* This isn't an ideal approach to measuring the offset of <svg /> tags.
* It would be preferable, given they behave like HTMLElements in most ways
* to use offsetLeft/Top. But these don't exist on <svg />. Likewise we
* can't use .getBBox() like most SVG elements as these provide the offset
* relative to the SVG itself, which for <svg /> is usually 0x0.
*/
const svgBoundingBox = current.getBoundingClientRect()
current = current.parentElement!
const parentBoundingBox = current.getBoundingClientRect()
Expand Down

0 comments on commit 54b956b

Please sign in to comment.