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

Disable pagechange event if page is not changing. #7289

Merged
merged 1 commit into from
May 10, 2016

Conversation

yurydelendik
Copy link
Contributor

Fixes #7288

@yurydelendik
Copy link
Contributor Author

yurydelendik commented May 3, 2016

Let's see if it breaks our viewer (wondering about presentation mode enter/exit and pdf opening)

@yurydelendik
Copy link
Contributor Author

  • check with mozcentral tests

@Snuffleupagus
Copy link
Collaborator

This seems to cause some glitches related to Presentation Mode, e.g

  1. Open the preview.
  2. Go to the first page.
  3. Enter Presentation Mode.
  4. Exit Presentation Mode.

Note how the top of the first page is now scrolled down a bit, when compared with the same steps in http://mozilla.github.io/pdf.js/web/viewer.html.

@Snuffleupagus
Copy link
Collaborator

Snuffleupagus commented May 4, 2016

The title of the PR is "Disable pagechange event if page is not changing.", but the code actually goes a bit further than that. If the intent of the patch is simply to not fire the event unnecessarily, then we probably still need https://github.com/mozilla/pdf.js/blob/master/web/pdf_viewer.js#L192-L196 even in the this._currentPageNumber === val case.
Please note that I've not tested it, but I'm guessing that that code would fix the Presentation Mode glitch that I described above, and might also prevent other issues where existing code relies on the current behaviour.

@yurydelendik
Copy link
Contributor Author

then we probably still need https://github.com/mozilla/pdf.js/blob/master/web/pdf_viewer.js#L192-L196 even in the this._currentPageNumber === val case.

That what I was afraid of. We need to remove this logic from currentPageNumber somehow.

@yurydelendik yurydelendik force-pushed the double-pagechange branch 2 times, most recently from adbb41f to 3c1832d Compare May 4, 2016 15:34
@yurydelendik
Copy link
Contributor Author

yurydelendik commented May 4, 2016

I was not able to reproduce to STR above. However I agree that not calling this.scrollPageIntoView might break things. I refactored it further to remove updateInProgress and extracted _resetCurrentPageView -- now the logic must be preserved.

@@ -673,13 +676,11 @@ var PDFViewer = (function pdfViewer() {
}

if (!this.isInPresentationMode) {
this.currentPageNumber = currentId;
this._setCurrentPageNumber(currentId, true);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this might cause the confusion -- we need to rethink this logic in the future


_setCurrentPageNumber:
function pdfViewer_setCurrentPageNumber(val, updateInProgress) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm wondering if we actually still need the updateInProgress parameter here, and in the events?
Previously we called scrollPageIntoView from the event handler in app.js (or viewer.js as it were), which seemed bad for e.g. the viewer components. In PR #6140, I removed some dead code, and also refactored this. With the changes in this patch, it seems to me at least, that updateInProgress is now pointless.
(Obviously there might be someone relying on it, but given that we've not really made any promises about the stability of the viewer components, I think we can remove it.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agree.

@timvandermeij
Copy link
Contributor

/botio-linux preview

@pdfjsbot
Copy link

pdfjsbot commented May 4, 2016

From: Bot.io (Linux)


Received

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

Live output at: http://107.21.233.14:8877/870fb4223fab35d/output.txt

@Snuffleupagus
Copy link
Collaborator

I can confirm that issue I reported in #7289 (comment) is now fixed.

Looks good, thank you for the patch!

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.

4 participants