swift-toolkit
swift-toolkit copied to clipboard
iOS: Swiping over the page number at the bottom of the screen in pagination mode navigates between chapters
Bug Report
Open an EPUB on iOS in pagination mode and swipe left from the level of the page number at the bottom of the screen for reflow epubs.
Observe that the epub navigates to the previous chapter.
Expected behavior
The reader should navigate to the previous page.
Environment
This was reported in our mobile app Allbok and is also reproducible in the R2TestApp.
Readium versions
r2-shared-swift: 2.xr2-streamer-swift: 2.xr2-navigator-swift: 2.x
Development environment
macOS: 11.6 platform: x86_64 carthage: 0.38.0 Xcode 13.0 Build version 13A233
I can reproduce.
Most likely the PaginationView under the web views is taking over the swipes. The web views are not spanning the whole vertical space to add some top and bottom margin. We should prevent switching to other resources, but I'm not sure we can really make it turn the pages, because top/bottom margins can't be added directly in the web view.
Could the padding be changed to live in the parent container instead?
The difficulty is that padding should apply to EPUB reflowable resources (EPUBReflowableSpreadView) but not fixed-layout ones (EPUBFixedSpreadView).
I don't think I'll have time to tackle this soon. But here's some pointers if you want to take a look:
- The
PaginationViewis handling the scrolling between resources and is taking over when a web view reaches the end of the resource. https://github.com/readium/r2-navigator-swift/blob/develop/r2-navigator-swift/Toolkit/PaginationView.swift#L349 - The
EPUBReflowableSpreadViewrenders reflowable resources and use thecontentInsetto add some top and bottom margin. I can't remember why we don't use thescrollView.contentInsetwhen in paginated mode, maybe a lead to explore. https://github.com/readium/r2-navigator-swift/blob/36f9643b39b39175437fd939aa2c8d8ac2101d05/r2-navigator-swift/EPUB/EPUBReflowableSpreadView.swift#L105-L125
For my use case, I only need to render reflowable epubs. I tried to set the scrollView.contentInsent but couldn’t fix it. Is there any simple solution for only reflowable case?