Skip to content

Add the scroll progressions in the EPUB viewport #620

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

Merged
merged 1 commit into from
Jun 20, 2025

Conversation

mickael-menu
Copy link
Member

  • Add the scroll progression ranges for each visible reading order resource in the EPUB's viewport object.
  • Fixed viewport positions with FXL EPUB.

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates how scroll progression ranges are handled in the EPUB viewport and fixes viewport positions for FXL EPUBs. Key changes include updating progression methods to return ClosedRange rather than Range, modifying associated variable types and computations in EPUBReflowableSpreadView.swift, and enhancing EPUBNavigatorViewController.swift by mapping progression values for visible reading order resources.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
Sources/Navigator/EPUB/EPUBSpreadView.swift Changed progression() to return a ClosedRange with a default value of 0 ... 1
Sources/Navigator/EPUB/EPUBReflowableSpreadView.swift Updated progression variable types and adjusted progression computation using ClosedRange
Sources/Navigator/EPUB/EPUBNavigatorViewController.swift Added a progressions property using a reduce on readingOrderIndices and updated locator calculations
Comments suppressed due to low confidence (3)

Sources/Navigator/EPUB/EPUBSpreadView.swift:347

  • The default progression value has been changed from an empty range (0 ..< 0) to a full range (0 ... 1). Update the documentation for progression(in:) to clarify that this default is used when a resource does not override the method.
        0 ... 1

Sources/Navigator/EPUB/EPUBNavigatorViewController.swift:647

  • [nitpick] The variable 'link' is re-declared in this diff. Consider renaming it (e.g., 'firstLink') to avoid potential confusion with any earlier usage of a similar variable name.
        let link = readingOrder[firstIndex]

Sources/Navigator/EPUB/EPUBReflowableSpreadView.swift:343

  • [nitpick] Verify that the use of a ClosedRange for progression correctly represents the intended behavior, ensuring that firstProgression and lastProgression are always in the correct order to prevent unintentional overlapping or inversion of the progression range.
        progression = firstProgression ... lastProgression

@mickael-menu mickael-menu merged commit 1c89282 into develop Jun 20, 2025
5 checks passed
@mickael-menu mickael-menu deleted the viewport-scroll branch June 20, 2025 16:16
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.

1 participant