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

Fix screen measurement when scrollWidth is a float #1055

Merged
merged 1 commit into from
Apr 8, 2024

Conversation

carbonrobot
Copy link
Contributor

@carbonrobot carbonrobot commented Apr 8, 2024

Fix screen measurement when scrollWidth is a float

The scrollWidth of a container is a rounded float value that causes the measurement to incorrectly round up when using Math.ceil if the container's actual size is +/- some small value.

This uses Math.round for the page calculation when using screen to avoid this problem and adds test coverage for the useMeasurement hook.

Actual Code fix: https://github.com/FormidableLabs/nuka-carousel/pull/1055/files#diff-d7aa6b5d278c998ec50a4b1441434b2e91b6a23af75fcd2ab8ddec4fff44aa14L30

Copy link

changeset-bot bot commented Apr 8, 2024

🦋 Changeset detected

Latest commit: 16cd0dd

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
nuka-carousel Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented Apr 8, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
nuka-carousel-website ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 8, 2024 8:09pm

@carbonrobot carbonrobot merged commit 67e5fee into main Apr 8, 2024
7 checks passed
@carbonrobot carbonrobot deleted the fix/screen-measurements branch April 8, 2024 21:11
@github-actions github-actions bot mentioned this pull request Apr 8, 2024
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

2 participants