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 rounding error when calculating element width #17

Merged
merged 1 commit into from
Jan 11, 2019
Merged

Fix rounding error when calculating element width #17

merged 1 commit into from
Jan 11, 2019

Conversation

anteq
Copy link

@anteq anteq commented Jan 10, 2019

When width of rootElm is not an integer, the decimal part is being lost in the width calculation. Rounding of width may cause to display the carousel improperly (showing 1px of next image).
According to the Mozilla developer docs https://developer.mozilla.org/en-US/docs/Web/API/Element/clientWidth , proper solution to get exact width is usage of getBoundingClientRect().
Can be used safely in modern browsers: https://caniuse.com/#feat=getboundingclientrect

@anteq anteq changed the title Fix rounding error when using clientWidth Fix rounding error when calculating element width Jan 10, 2019
@ZouYouShun
Copy link
Owner

Thanks a lot, @anteq

@ZouYouShun ZouYouShun merged commit d01066c into ZouYouShun:master Jan 11, 2019
@anteq
Copy link
Author

anteq commented Jan 11, 2019

Cool, no problem! Can we expect that to be included in the release soon?

@anteq
Copy link
Author

anteq commented Jan 18, 2019

Hey @ZouYouShun, can you estimate when you'll be able to release it onto npm? Looking forward to it since its an issue that affects our usage.

Thank you, really appreciate the work put into this library!

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.

2 participants