Skip to content
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

Add (basic) support for Spread modes in PresentationMode (issue 14749) #14877

Merged

Conversation

Snuffleupagus
Copy link
Collaborator

  • Simplify the signature of BaseViewer._scrollIntoView and make the method private

    In PR 14112 usage of this internal method was reduced, and it thus can't hurt to clean-up things a little bit more.
    Note in particular that we can simplify the call-sites by directly passing in the already available PDFPageView-instance, since the id-property those contain can replace the previous pageNumber-parameter[1].

    Given that the method name has always been prefixed with an underscore it was thus never intended to be "public", hence we can now enforce that with modern ECMAScript features.


    [1] There's already a bunch of other spots, throughout the viewer-code, where we assume that the PDFPageView.id-property contains proper page numbers (and not e.g. indices); note how we initialize the PDFPageView-instances in the BaseViewer.setDocument-method.

  • Add (basic) support for Spread modes in PresentationMode (issue 14749)

    After recent changes, adding basic Spread mode support in PresentationMode has now become reasonably straightforward.

    However, documents with varying page sizes are non-trivial to handle and would require re-writing (or at least re-factoring) a bunch of the zooming-code.
    Hence this PR purposely only allow Spread modes to be used, in PresentationMode, for documents where all pages have exactly the same size. While this obviously isn't a fully complete solution, it will however cover the vast majority of all documents and should hopefully be deemed good enough for now.

…ethod private

In PR 14112 usage of this *internal* method was reduced, and it thus can't hurt to clean-up things a little bit more.
Note in particular that we can simplify the call-sites by directly passing in the already available `PDFPageView`-instance, since the `id`-property those contain can replace the previous `pageNumber`-parameter[1].

Given that the method name has always been prefixed with an underscore it was thus never intended to be "public", hence we can now enforce that with modern ECMAScript features.

---
[1] There's already a bunch of other spots, throughout the viewer-code, where we assume that the `PDFPageView.id`-property contains proper page *numbers* (and not e.g. indices); note how we initialize the `PDFPageView`-instances in the `BaseViewer.setDocument`-method.
After recent changes, adding *basic* Spread mode support in PresentationMode has now become reasonably straightforward.

However, documents with *varying* page sizes are non-trivial to handle and would require re-writing (or at least re-factoring) a bunch of the zooming-code.
Hence this PR *purposely* only allow Spread modes to be used, in PresentationMode, for documents where all pages have exactly the same size. While this obviously isn't a fully complete solution, it will however cover the vast majority of all documents and should hopefully be deemed good enough for now.
@Snuffleupagus
Copy link
Collaborator Author

/botio-linux preview

@pdfjsbot
Copy link

pdfjsbot commented May 5, 2022

From: Bot.io (Linux m4)


Received

Command cmd_preview from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.241.84.105:8877/e28a3bf6328fbd7/output.txt

@pdfjsbot
Copy link

pdfjsbot commented May 5, 2022

From: Bot.io (Linux m4)


Success

Full output at http://54.241.84.105:8877/e28a3bf6328fbd7/output.txt

Total script time: 2.77 mins

Published

@timvandermeij timvandermeij merged commit be67ec4 into mozilla:master May 7, 2022
@timvandermeij
Copy link
Contributor

Looks good!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Two page spread doesn't work in fullscreen presentation mode
3 participants