readium / swift-toolkit

A toolkit for ebooks, audiobooks and comics written in Swift
https://readium.org/mobile/
BSD 3-Clause "New" or "Revised" License
256 stars 101 forks source link

EPUB page does not snap correctly when layout changed in the multitasking Split View #321

Open vladimirbol opened 1 year ago

vladimirbol commented 1 year ago

Bug Report

What happened?

The content of the epub is not correctly aligned with the page when the middle line of the split screen is dragged to either side.

CleanShot 2023-07-20 at 14 18 11

Expected behavior

The content of the epub - page - should be well aligned with the app visible content area after the shift of the middle line everytime.

How to reproduce?

moby-dick-mo.epub.zip

Environment

Environment: device, simulator,

Development environment

echo "macOS: sw_vers -productVersion" macOS: 13.3.1

echo "platform: uname -m" platform: arm64

echo "carthage: carthage version" zsh: command not found: carthage

xcodebuild -version Xcode 14.3 Build version 14E222b

Testing device

Additional context

    private func xOffsetForIndex(_ index: Int) -> CGFloat {
        (readingProgression == .rtl)
            ? scrollView.contentSize.width - (CGFloat(index + 1) * scrollView.bounds.width)
            : scrollView.bounds.width * CGFloat(index)
    }