-
Notifications
You must be signed in to change notification settings - Fork 10k
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
Ensure that the 'pagechanging' event is triggered on load, to avoid incorrect initial button state (PR 7289 followup) #7405
Ensure that the 'pagechanging' event is triggered on load, to avoid incorrect initial button state (PR 7289 followup) #7405
Conversation
…ncorrect initial button state (PR 7289 followup) With the changes in PR 7289, we no longer dispatch a 'pagechanging' event on load. Since most PDF documents open on the first page, this means that the `previous` and `firstPage` buttons are not correctly disabled.
/botio-linux preview |
From: Bot.io (Linux)ReceivedCommand cmd_preview from @Snuffleupagus received. Current queue size: 0 Live output at: http://107.21.233.14:8877/dbbc44bf362a39f/output.txt |
From: Bot.io (Linux)SuccessFull output at http://107.21.233.14:8877/dbbc44bf362a39f/output.txt Total script time: 1.03 mins Published |
Looks like it's a little bit confusing. Can we try to move https://github.com/mozilla/pdf.js/blob/master/web/app.js#L1956-L1962 somewhere e.g. in updateUIToolbar() function on call it, first, on viewer initialization, and then on pagechanging. (We can move more stuff there e.g. scale change or file opened) |
@yurydelendik Does this look like what you had in mind master...Snuffleupagus:updateUIToolbar? |
@Snuffleupagus yes, but I'm not sure we need to provide any args to the function (can it pull all needed info from the object states) |
Approach in #7405 (comment) looks good. We can re-iterate with further optimizations once it's landed to fix the regression. |
Sorry, I'm not sure that I understand where you're suggesting that we should get the values from if we're not passing them into the method!? |
Ideally, we shall have a function that if we call it, the toolbar state will be updated to the state of the model the viewer in (without knowing who calls it, but atm resetNumPages or scaleValue provide this information). I anticipate that this function will be call at any event, e.g. initializing/zooming/scrolling/document change/etc. or combination of several. It not a problem, but it will be good to move/split this method into several (for each toolbar, context menu) and call them from the viewer's. |
With the changes in PR #7289, we no longer dispatch a 'pagechanging' event on load. Since most PDF documents open on the first page, this means that the
previous
andfirstPage
buttons are not correctly disabled.A picture is worth a thousand words:
/cc @yurydelendik