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 increasing scrolling error of scrollBy by compensation #1139

Open
wants to merge 22 commits into
base: master
Choose a base branch
from

Conversation

MrRogerHuang
Copy link

`scrollBy' in this file

scrollBy(x, y, silent){

operates scrollLeft or scrollTop for moving to previous or next page.
However, the document
https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollLeft
said: "On systems using display scaling, scrollLeft may give you a decimal value."
Thus, operations on scrollLeft or scrollTop could be not precise!
E.g., this.container.scrollTop is 0 and y is 100, after this.container.scrollTop += y, this.container.scrollTop might become 99.xxx!
The worse problem is this error increases with increasing prev() or next(). It can result in this kind of page shift problem:

With the compensation algorithm in this pull request branch, the problem is alleviated!

This compensation algorithm works also for horizontal writing ePub. E.g, the one without compensation:

The one with compensation:

@felipe-barros
Copy link

Hey! Thank you! It worked for me <3

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.

3 participants