Skip to content

Conversation

@mickael-menu
Copy link
Member

Related to #680, but for FXL EPUB.

Added

Navigator

  • Added fit preference for fixed-layout publications (PDF and FXL EPUB) to control how pages are scaled within the viewport.
    • In the PDF navigator, it is only effective in scroll mode. Paginated mode always uses page fit due to PDFKit limitations.

Changed

Navigator

  • The fixed-layout navigators (PDF and FXL EPUB)'s content inset behavior has changed:
    • iPhone: Continues to apply window safe area insets (to account for notch/Dynamic Island).
    • iPad/macOS: Now displays edge-to-edge with no automatic safe area insets.
    • You can customize this behavior with VisualNavigatorDelegate.navigatorContentInset(_:).

Copy link

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 adds the fit preference to fixed-layout EPUB publications, extending an existing feature that was previously only available for PDF documents. The implementation allows users to control how FXL EPUB pages are scaled within the viewport, with three options: auto (default), page (fit both dimensions), and width (fit to width with vertical scrolling). Additionally, the PR updates the content inset behavior for both PDF and FXL EPUB navigators to display edge-to-edge on iPad/macOS while continuing to respect safe areas on iPhones.

  • Added fit preference to EPUB preferences, settings, and editor with proper integration across the navigator stack
  • Implemented JavaScript logic to handle fit modes (auto/page/width) with appropriate scaling and positioning based on page type
  • Updated safe area inset handling for FXL EPUB to match PDF behavior (edge-to-edge on iPad/macOS, safe area on iPhone)

Reviewed changes

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

Show a summary per file
File Description
Sources/Navigator/EPUB/Preferences/EPUBPreferences.swift Added fit property with documentation for fixed-layout viewports
Sources/Navigator/EPUB/Preferences/EPUBSettings.swift Integrated fit into settings resolution and defaults
Sources/Navigator/EPUB/Preferences/EPUBPreferencesEditor.swift Added fit preference editor with supported values
Sources/Navigator/EPUB/EPUBNavigatorViewModel.swift Added fit to settings change detection for pagination invalidation
Sources/Navigator/EPUB/EPUBNavigatorViewController.swift Updated content inset logic to apply edge-to-edge display on iPad/macOS for fixed layouts
Sources/Navigator/EPUB/EPUBFixedSpreadView.swift Passed fit preference value to JavaScript layer
Sources/Navigator/EPUB/Scripts/src/fixed-page.js Implemented core fit logic with width/page scaling and positioning based on page type
Sources/Navigator/EPUB/Scripts/src/index-fixed-wrapper-one.js Updated single-page wrapper to accept and pass fit parameter
Sources/Navigator/EPUB/Scripts/src/index-fixed-wrapper-two.js Updated spread wrapper to accept and pass fit parameter
Sources/Navigator/EPUB/Assets/Static/scripts/readium-fixed-wrapper-one.js Minified version of updated single-page wrapper
Sources/Navigator/EPUB/Assets/Static/scripts/readium-fixed-wrapper-two.js Minified version of updated spread wrapper
TestApp/Sources/Reader/Common/Preferences/UserPreferences.swift Added fit parameter to fixed-layout preferences UI
CHANGELOG.md Updated feature description to reflect support for both PDF and FXL EPUB

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@mickael-menu mickael-menu merged commit c1fd5b5 into develop Dec 5, 2025
11 checks passed
@mickael-menu mickael-menu deleted the fit-fxl branch December 5, 2025 11:53
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.

2 participants