Skip to content

Fix default FXL spread positions#714

Merged
mickael-menu merged 5 commits intodevelopfrom
fix-fxl-images
Feb 10, 2026
Merged

Fix default FXL spread positions#714
mickael-menu merged 5 commits intodevelopfrom
fix-fxl-images

Conversation

@mickael-menu
Copy link
Member

Fixed

Navigator

  • The first resource of a fixed-layout EPUB is now displayed on its own by default, matching Apple Books behavior.
  • Fixed the default spread position for single fixed-layout EPUB spreads that are not the first page.

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

Adjusts fixed-layout EPUB spread construction and JSON page positioning so the first FXL resource is displayed alone by default (Apple Books-like), and unpaired single pages get a corrected default left/right position.

Changes:

  • Updates FXL two-page spread generation to default the first resource to a centered single spread (unless overridden by offsetFirstPage or explicit page property).
  • Reworks default page position for EPUBSingleSpread JSON output to distinguish first vs. non-first single pages.
  • Adds comprehensive navigator spread unit tests and documents the fixes in the changelog.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
Tests/NavigatorTests/EPUB/EPUBSpreadTests.swift Adds new unit tests covering spread creation, pairing rules, and spread helper APIs.
Sources/Navigator/Preferences/Types.swift Removes ReadingProgression.startingPage helper used for default positioning.
Sources/Navigator/EPUB/EPUBSpread.swift Implements new first-page centering behavior for FXL and fixes default page position for single spreads.
CHANGELOG.md Records the Navigator fixes under Unreleased.

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

/// Builds a list of two-page spreads for the given Publication.
///
/// - Parameter offsetFirstPage: User preference to offset the first
/// resource.
Copy link
Contributor

Choose a reason for hiding this comment

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

Can all be parameters be documented here? swift build -Xswiftc otherwise throws warnings for parameters that aren't documented if at least one is.

Copy link
Member Author

Choose a reason for hiding this comment

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

I updated to remove the - Parameter and inline the explanation for offsetFirstPage instead. I'm not a fan of having a list of - Parameter when they are self-explanatory, but I would compromise for public APIs.

Are you able to only document the public APIs? I think documenting (or checking) all the internal APIs would add too much noise.

]
}

/// Returns the default spread position (left or right) for the single
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think this improves the Quick Help, as this is the short description of what this function does. I prefer to use - Returns to clarify the return value in the context of the function. For example:

/// Registers a new ``InputObserver`` for the observable receiver.
///
/// - Returns: An opaque token which can be used to remove the observer with
/// `removeInputObserver`.
@discardableResult
func addObserver(_ observer: InputObserving) -> InputObservableToken

Before:
Screenshot 2026-02-10 at 17 33 42
After:
Screenshot 2026-02-10 at 17 32 58

Copy link
Member Author

Choose a reason for hiding this comment

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

In this case, I think I should have used "Resolve the default spread position..." instead of "Returns...". That was lazy wording 😅

@mickael-menu mickael-menu merged commit 146d1b3 into develop Feb 10, 2026
5 checks passed
@mickael-menu mickael-menu deleted the fix-fxl-images branch February 10, 2026 17:10
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.

3 participants