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
Two-Up View Redux #2660
Two-Up View Redux #2660
Conversation
Fantastic work, thank you! Nice to see that this feature is still being worked on :) |
You're welcome! Now only if someone would make a decision about the possible problems above... |
/botio-windows preview |
From: Bot.io (Windows)ReceivedCommand cmd_preview from @gigaherz received. Current queue size: 0 Live output at: http://107.22.172.223:8877/34114f1bb3fd149/output.txt |
From: Bot.io (Windows)SuccessFull output at http://107.22.172.223:8877/34114f1bb3fd149/output.txt Total script time: 0.21 mins Published |
I can't make a decision, but my oppinions/suggestions are as follows: I'd say that if the number of menu items is growing too large, it should be discussed in a separate issue. Feel free to open an issue about it, I guess -- it doesn't bother me yet. You could see if adding a separator above the Page Display sub-menu looks fine, but adding any other menu stuffs should be done separately since it's not part of this feature. Menuitems looking like radio-buttons may be a Firefox limitation, since the standard Windows menu system is perfectly able to draw them. For bookmarks, you may want to add more args to the url, something like |
The updated viewer looks really nice. I only spot one problem: if I change the view on Windows 7, Firefox 18.0.1, on http://107.22.172.223:8877/34114f1bb3fd149/web/viewer.html, I need to scroll down just a tiny bit to actually see the page. I.e.: if I change the view, I keep seeing the AJAX loader thingy on the first page and it only disappears if I scroll down only a little bit. Strange... |
/botio-linux preview |
From: Bot.io (Linux)ReceivedCommand cmd_preview from @jviereck received. Current queue size: 0 Live output at: http://107.21.233.14:8877/bb8aab1c411e694/output.txt |
From: Bot.io (Linux)SuccessFull output at http://107.21.233.14:8877/bb8aab1c411e694/output.txt Total script time: 0.22 mins Published |
Personally, I would like to have a toolbar button to switch between the different view modes. But that can be done as a followup. Some notes:
Otherwise from playing with the preview, looks good :) |
@waddlesplash This is a great effort so far, but I have made a couple of observations:
I really hope that the above doesn't sound negative. I'm excited about a working two-up mode in pdf.js and wanted to help out by adding my thoughts. |
Wow, I got a lot more attention on this than any of my other PRs! O_o Sadly, I am busy and won't get back to this until the end of next week at the earliest. I'll address all of your comments then. |
It's all right. No one had worked on this for months, people can wait 2 weeks more ;P |
@waddlesplash: the issue that I reported earlier is also mentioned by @Snuffleupagus, so you can ignore my comment from earlier. Please, do take your time. No need to hurry, I'm just glad that you are willing to work on this nice feature! Thank you in advance for your work. |
@waddlesplash the updated to-do list looks good! |
Woah, it's actually clickable and functional? |
You mean the TODO list? That's a new GitHub feature. You just add |
Wouldn't #2747 also fix point 3 on the to-do list? |
It would -- if it gets merged. |
OK, I have a prototype of this that fixes a lot of the problems. However, it relies on having the browser NOT word-wrap the two |
Whoops! nevermind, figured it out. I needed to use |
OK, just pushed a MAJOR change. This should fix three-up, margins, and fullscreen mode (at least). It creates |
@waddlesplash Just looking at the code, this seems to be a much simpler solution. Nice work so far! |
@waddlesplash CSS3 has |
} | ||
}, | ||
|
||
nextPage: function pdfViewNextPage() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know what you mean by nextPage
, but in twoUp mode you don't always go to the next page but instead to the next container that might hold a single or multiple pages. Same goes for prevPage
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So what should I call it? advancePage
? nextPageContainer
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@waddlesplash Your suggestion nextPageContainer
sound good to me.
Overall, this patch looks good so far, but I'd like to do another round of review once the comments above are addressed. |
What are the opinions about: https://github.com/mozilla/pdf.js/pull/2660/files#r3259033 ? |
@@ -1506,6 +1659,15 @@ var PDFView = { | |||
|
|||
if (hash.indexOf('=') >= 0) { | |||
var params = PDFView.parseQueryString(hash); | |||
if ('twoup' in params) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Has anyone looked into the spec to see if there are standard parameters to setup this view mode?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is that in the PDF reference? I can't find it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
@@ -3061,6 +3261,26 @@ document.addEventListener('DOMContentLoaded', function webViewerLoad(evt) { | |||
PDFView.rotatePages(90); | |||
}); | |||
|
|||
document.getElementById('one_page_view').addEventListener('click', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use camelCase id's since all id's in the viewer are camel case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But the previous event listener (document.getElementById('page_rotate_cw').addEventListener('click',
) is like that...
I'm fine with it, just wanted to make sure that I understood the reasoning. |
OK well, once I fix @brendandahl's comments you can fix that. |
@waddlesplash I'm currently fixing the review comments for the code I wrote. |
@Snuffleupagus done. Do your stuff and tell me when you're done :) |
Some great work seems to be going on here. Can't wait to test a new preview :) |
} else { | ||
PDFView.showCover(PDFView.showCoverPage); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this code block really necessary here? Isn't it enough to just have this logic in the setHash()
method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I'll try without it
I have to concentrate on my studies and fight a pretty long TODO queue. Therefore I won't make it to spend time on reviewing this patch in the near future. Can someone else please make sure this gets reviewed and lands? |
@brendandahl I've now got a working prototype for a more generic |
Splitting that out into another PR would be good. We could land that first then bring those changes into this PR. |
OK, so what's the course of action for this PR? |
@waddlesplash Unless something unforeseen happens during the weekend, I'll submit a PR with a reworked |
getVisibleElements() just got merged. Now let's hope we can find someone to review this... Would be really cool to be able to use this! |
@timvandermeij This PR needs to be rebased, since it currently isn't in merge-able condition. Also there is some clean-up needed in the code, because of the rewrite of |
Oh, indeed. I also see some comments on the code above, so these need to be addressed too. |
@waddlesplash Are you still working on this? If not, I would be willing to take it over and finish the PR! |
Superseded by PR #3723. |
Building on what @Moistly started in #2395 (to fix #1475). Note that the following things might still be an issue:
To-Do (before merging)
When two-up is active and the zoom is set to 'page-fit', the vertical alignment of the pages becomes wrong. In this configuration, the uppermost pixels of the next pages become visible in the bottom of the screen. Note that I can only reproduce this if "Show Cover Page in Two Page View" is toggled on.The above also sometimes happen when switching to/from two-up, but less frequently.
When twoup is turned on, the cover page may randomly only draw half the page and never draw the rest unless the page is reloadedI can no longer reproduce.