Skip to content

Commit

Permalink
Fix destructuring issue with getBoundingClientRect
Browse files Browse the repository at this point in the history
  • Loading branch information
drzax committed Sep 29, 2020
1 parent 44ae7fe commit c190307
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions src/Scrollyteller/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,29 @@ const Scrollyteller = <T,>({
// panels before the px/pct progress can be accurately measured.
const panelPositions = panelElementReferences.current
.map(({ data, element }) => {
const boundingClientRect = element.getBoundingClientRect();
const {
top,
right,
bottom,
left,
width,
height,
x,
y,
} = element.getBoundingClientRect();

return {
element,
data,
measurements: {
...boundingClientRect,
top,
right,
bottom,
left,
width,
height,
x,
y,
},
};
})
Expand Down

0 comments on commit c190307

Please sign in to comment.