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

Double Page (No Cover) now keep opposite flow of Double Page fixing Split Double Spreads #1236

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

Conversation

kanjieater
Copy link

@kanjieater kanjieater commented Sep 24, 2023

Hi Gotson 👋 Long time admirer & user, first time contributor - let me know if there's anything I can do to have this move forward, thanks.

Use-Case: Attempting to solve #803. Users who read with double pages want to easily view double spreads where both pages are shown together. In some cases, double spreads are shifted so that only one page of the double spread is visible. The aim is to provide a feature that allows users to read pages together as double spreads.

Double Pages & Double Pages (no cover): This enables users to switch between these layouts to ensure that double spreads are always displayed together. By injecting an empty page after a Landscape page in DP NC layout, Split Double Spreads (SDS) are displayed correctly as double spreads, and users can easily switch to the appropriate layout easily ("D" hotkey).

Example:
A Landscape page can throw things off - like this inner leaflet scan after the double cover/back landscape pages:
image

Then the next page was this:
Original Algorithm:
Both layouts could be in lockstep after a landscape page disrupted the 2 page stepping
image
This resulted in the flow through the whole volume being off by one, and no way to see it correctly in komga besides manually readjusting potentially thousands of volumes and pages manually:
image

This PR, Now you can switch to the alternate layout if it matches you book:
image
image

Now you can switch to the right flow is as the author intended:
image

The additional issue of where pages could do:
DP: [E, 1], [2, 3], [4, E], [5, E]
has now been changed to always just show the next pages next to each other:
[E, 1], [2, 3], [4, 5]
If the last page was a Split Double Spread, then there was no way to see the two pages together previously.
I think this was done under the assumption that the last page was always the back cover, but issues of comics online often don't have this given they haven't been compiled into a volume (which may add additional pages between chapters or an ending cover)

Example of Original Algorithm
image

This PR:
image

The last additional issue brought up in 803, was resolved a year or two before (not adding an empty page if the first page was landscape). This should resolve the concerns from 803 completely.

@@ -9,40 +9,36 @@ export function buildSpreads(pages: PageDtoWithUrl[], pageLayout: PagedReaderLay
if (pageLayout !== PagedReaderLayout.SINGLE_PAGE) {
const spreads = [] as PageDtoWithUrl[][]
const pagesClone = cloneDeep(pages)
let lastPages = undefined
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed lastPages, and the chunk handling it below as the loop part of the algorithm handles getting the last image in place

@@ -95,23 +95,20 @@ describe('Double Pages', () => {
] as PageDtoWithUrl[]

const spreads = buildSpreads(pages, pageLayout)

expect(spreads.length).toEqual(4)
// Expecting [E, 1], [2, 3], [4, 5]
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Talked about this in more details with an example in the PR original post

spreads.push([p2])
} else {
spreads.push([p, p2])
}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically all the same logic, just if it's DBNC layout, then just push a empty page after the previous page if and only if it was a landscape page. This guarantees the layouts will be opposite if landscape pages existed, which is what throws off the flow.

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