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

RTL Fixed layout epub spread mode rendition.next() not working #1069

Open
hyhchan opened this issue Jun 1, 2020 · 8 comments
Open

RTL Fixed layout epub spread mode rendition.next() not working #1069

hyhchan opened this issue Jun 1, 2020 · 8 comments

Comments

@hyhchan
Copy link

hyhchan commented Jun 1, 2020

RTL fixed layout epub, when opening with spread, rendition.next() has no response.
rendition.prev() works.

@alidbc
Copy link
Contributor

alidbc commented Jun 2, 2020

Check issue #1053, could be relevant to yours

@hyhchan
Copy link
Author

hyhchan commented Jun 2, 2020

Don't know if #1053 is relevant since it is dealing with flow and mine is pre-paginated. I tested using the download from github this morning and the problem still exists.

I made the following epub to test. The epub works as expected in Apple book.
test-rtl-epub.zip

This problem surface in the latest version of epub.js. I was directed here from foliate because the last version used by foliate didn't have this issue (but it failed to render vertical text pages and only advance to next chapter rather than next page. The issue is fixed in this version)

@alidbc
Copy link
Contributor

alidbc commented Jun 2, 2020

Can you post your settings?

@hyhchan
Copy link
Author

hyhchan commented Jun 2, 2020

firefox 76.0.1 on Ubuntu 20.04, epub.js code downloaded from github using the download button, and using the example/input.html to load the book.

Also, will it be related to #1070 ?

BTW, in foliate, if the book dimension is changed to portrait mode (single page, no spread) then both directions works.

@alidbc
Copy link
Contributor

alidbc commented Jun 2, 2020

The issue happens in Firefox(Negative RTL scroll mode) and with pre-paginated RTL books.

the calculation goes wrong because this.layout.delta in pre-paginated layout and double page is equal to column width

current line code for calculating left in RTL(negative scroll type):
left = this.container.scrollLeft + ( this.layout.delta * -1 );

possible fix is the following code(needs testing):
left = this.container.scrollLeft - this.container.offsetWidth;

if time permits will issue a PR

@hyhchan
Copy link
Author

hyhchan commented Jun 2, 2020

I replaced line 449 of src/managers/default/index.js with your suggestion. The navigation now works.
Then the following observation:

  1. Title page is on the right panel instead of the left(probably RTL fixed layout spread mode rendition.display() always display the offset at right panel #1070)
    Screenshot from 2020-06-02 14-37-46

  2. If the following pages doesn't specify page-spread-*, the pages rendered as intended, but with a gap in the middle (see below)

Screenshot from 2020-06-02 14-28-19

  1. If the 2nd page has page-spread-right on the itemref, only the right side is rendered. Left side is blank.
    Screenshot from 2020-06-02 14-38-34

Navigate one more time page 3 shows up on the right panel and the order screwed up.

Screenshot from 2020-06-02 14-39-12

Navigate back to cover now page 2 is showing up beside the cover.

Screenshot from 2020-06-02 14-39-57

At all time the left page is not align to the right and thus leaving a gap between the pages.

@hyhchan
Copy link
Author

hyhchan commented Jun 4, 2020

I managed to trace the error 2 of the above (a gap between the pages of the fixed layout book). The contents.fit() doesn't know if the page is at the right or left of the spread and only test if the page is "page-spread-left". In the rtl book if this is not set the page will be left aligned. I did a quick hack of the code to have section recorded the progression of the book, and added

(section.direction === "rtl" && (section.index % 2 === 0))

to the condition for padding margin-left and it works. However don't know if it will break other things.

And I think adding the direction to the section can also help fix #1070 - the code can check if the target index is even, then jump to target-1 and render both pages unless target - 1 is marked blank by spread-left|right, which will need the direction to check at the manager.display() code

@chowdhuriarijit
Copy link

any update on this issue now i am experiencing same problem in chrome version 85.x

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

No branches or pull requests

3 participants