swift-toolkit icon indicating copy to clipboard operation
swift-toolkit copied to clipboard

iOS: Swiping over the page number at the bottom of the screen in pagination mode navigates between chapters

Open chrfalch opened this issue 4 years ago • 4 comments

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.x
  • r2-streamer-swift: 2.x
  • r2-navigator-swift: 2.x

Development environment

macOS: 11.6 platform: x86_64 carthage: 0.38.0 Xcode 13.0 Build version 13A233

chrfalch avatar Oct 08 '21 09:10 chrfalch

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.

mickael-menu avatar Oct 08 '21 11:10 mickael-menu

Could the padding be changed to live in the parent container instead?

chrfalch avatar Oct 08 '21 11:10 chrfalch

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 PaginationView is 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 EPUBReflowableSpreadView renders reflowable resources and use the contentInset to add some top and bottom margin. I can't remember why we don't use the scrollView.contentInset when 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

mickael-menu avatar Oct 08 '21 11:10 mickael-menu

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?

enverygtlr avatar Jul 18 '23 14:07 enverygtlr