Skip to content

Commit

Permalink
chore(prettier): 🤖 ✨
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Sep 13, 2023
1 parent ffad204 commit 9e7f63d
Showing 1 changed file with 20 additions and 14 deletions.
34 changes: 20 additions & 14 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -515,20 +515,26 @@ export const compute = (target: Element, options: Options): ScrollAction[] => {

const { scrollLeft, scrollTop } = frame
// Ensure scroll coordinates are not out of bounds while applying scroll offsets
blockScroll = scaleY === 0 ? 0 : Math.max(
0,
Math.min(
scrollTop + blockScroll / scaleY,
frame.scrollHeight - height / scaleY + scrollbarHeight
)
)
inlineScroll = scaleX === 0 ? 0 :Math.max(
0,
Math.min(
scrollLeft + inlineScroll / scaleX,
frame.scrollWidth - width / scaleX + scrollbarWidth
)
)
blockScroll =
scaleY === 0
? 0
: Math.max(
0,
Math.min(
scrollTop + blockScroll / scaleY,
frame.scrollHeight - height / scaleY + scrollbarHeight
)
)
inlineScroll =
scaleX === 0
? 0
: Math.max(
0,
Math.min(
scrollLeft + inlineScroll / scaleX,
frame.scrollWidth - width / scaleX + scrollbarWidth
)
)

// Cache the offset so that parent frames can scroll this into view correctly
targetBlock += scrollTop - blockScroll
Expand Down

0 comments on commit 9e7f63d

Please sign in to comment.