Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace scrollHeight/scrollWidth with stored scrollSize #177

Merged
merged 1 commit into from
Sep 13, 2023

Conversation

inokawa
Copy link
Owner

@inokawa inokawa commented Sep 13, 2023

#175

As described in mdn, scrollHeight is rounded number but scrollTop and contentRect from ResizeObserver has non-rounded number.
Because of this difference, scrollSize which is used internally in this lib (calcurated from contentRect) and scrollSize what users can get from handle (scrollHeight) can have different value if browser's window.devicePixelRatio has decimal value (ex. 1.5 or 1.25 in Windows OS). That makes it harder to implement at-bottom detection logic in userland.

So this PR will replace scrollHeight usages with stored scrollSize. scrollHeight was necessary in early implementation of scrollToIndex but it seems that it's not now.

@inokawa inokawa merged commit ad81df0 into main Sep 13, 2023
2 checks passed
@inokawa inokawa deleted the scroll-size-store branch September 13, 2023 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant