Skip to content

Add continuous vertical scrolling for reflowable EPUBs#766

Draft
shiyukk wants to merge 1 commit intoreadium:developfrom
shiyukk:feature/vertical-scroll
Draft

Add continuous vertical scrolling for reflowable EPUBs#766
shiyukk wants to merge 1 commit intoreadium:developfrom
shiyukk:feature/vertical-scroll

Conversation

@shiyukk
Copy link
Copy Markdown

@shiyukk shiyukk commented Apr 2, 2026

Summary

Add true continuous vertical scrolling for reflowable EPUBs when EPUBPreferences.scroll is enabled.

Instead of keeping each spread in the horizontal pagination container, scroll mode now stacks spreads vertically in a dedicated continuous container, so readers can move through chapters without horizontal page turns.

Scope

applies only to reflowable EPUBs in scroll mode.

keeps existing paginated behavior unchanged when scroll mode is disabled.

does not affect fixed-layout EPUBs.

Notes

This introduces ContinuousPaginationView and updates reflowable spread navigation, height measurement, and location/viewport calculation to work in a multi-spread continuous flow.

Render reflowable EPUB spreads in a single vertical container when `EPUBPreferences.scroll` is enabled, so readers can scroll through all chapters continuously without swiping horizontally between spreads.
@grighakobian
Copy link
Copy Markdown
Contributor

grighakobian commented Apr 6, 2026

Thanks @shiyukk for tackling this — continuous vertical scrolling is a highly requested feature. I’ve been working on a separate branch to implement the same feature, so I have some insights into the trade-offs involved. I have a few architectural concerns and specific issues I’d like to discuss.

Main concern: ContinuousPaginationView duplicates PaginationView

The new ContinuousPaginationView (519 lines) reimplements most of the infrastructure that already exists in PaginationView, including loadedViews, loadingIndexQueue, loadNextPage(), scheduleLoadPages, flushViews, and page lifecycle management. The only significant differences are the layout axis and the absence of paging snap.

To support vertical continuous scrolling, we can extend PaginationView by adding a ScrollDirection enum (.horizontal / .vertical) and branching on it in layout, preloading, and scroll tracking. This approach avoids maintaining two parallel view hierarchies with duplicated logic and ensures that future bug fixes are centralized.

I recommend refactoring to extend PaginationView instead of introducing a separate class. Collaborating on this feature would be beneficial, as I’ve been working on it since last week and have a working solution that extends PaginationView without creating a separate view for vertical continuous scrolling. I plan to submit a pull request by the end of the week, as I’ll be off until Wednesday.

@shiyukk
Copy link
Copy Markdown
Author

shiyukk commented Apr 6, 2026

Thanks for the detailed feedback! You're right that extending PaginationView with a scroll direction is cleaner than a separate class. Happy to collaborate on your branch — I can help with testing or pick up specific pieces. Let me know if you'd like me to close this PR or keep it open as reference.

@mickael-menu
Copy link
Copy Markdown
Member

mickael-menu commented Apr 8, 2026

Thank you for your contribution @shiyukk. Please don't hesitate to reach out via Discord or GitHub issues before starting a new PR. We can discuss the details and confirm if the feature is already planned or in progress before you begin your work.

I haven't looked at the code yet, but I agree with @grighakobian's analysis.

I did try your code and it looks very promising. I have one UX caveat: we should not be able to scroll through the whole publication while it's loading all the intermediate resources. If a next (or previous) resource is currently loading, the user should not be able to scroll past it, until it is loaded.

Also, I think the changes in the Test App are out-of-scope for this PR.

@shiyukk
Copy link
Copy Markdown
Author

shiyukk commented Apr 10, 2026

Thanks for trying it out and the feedback!

Good point on the scroll-past-loading issue, I hadn't thought about that. I think this could be handled by clamping contentSize to only include loaded resources (or the one currently loading), then expanding it as each resource finishes.

Sorry for not reaching out first, will definitely check in on Discord or open an issue before starting next time. Appreciate the guidance!

@mickael-menu mickael-menu marked this pull request as draft April 17, 2026 15:48
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