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

Remove PDFViewerApplication.updateScaleControls (issue 6158) #6195

Merged
merged 1 commit into from
Jul 11, 2015
Merged

Remove PDFViewerApplication.updateScaleControls (issue 6158) #6195

merged 1 commit into from
Jul 11, 2015

Conversation

Snuffleupagus
Copy link
Collaborator

With this patch we're getting very close to fixing #6158.

The only use-case for PDFViewerApplication.updateScaleControls is to try and avoid calling selectScaleOption from the scalechange event handler in viewer.js.
This will only happen when the user has manually changed the scale by using the <select> dropdown, which means that in reality this is just a micro optimization. Furthermore, selectScaleOption is only skipped for the "named" scale values (e.g. auto, page-actual, page-fit, page-width), thus further reducing the value of this code.

Also, since we're updating the scale <select> dropdown from an event handler, we're currently depending on the event being dispatched (and handled) completely before the next scalechange event. Relying on the execution order of the code in this way, even though it currently works, seems unfortunate since it could potentially cause the internal scale value and the UI from getting out of sync.

*With this patch we're getting very close to fixing 6158.*

The only use-case for `PDFViewerApplication.updateScaleControls` is to try and avoid calling `selectScaleOption` from the `scalechange` event handler in viewer.js.
This will *only* happen when the user has manually changed the scale by using the `<select>` dropdown, which means that in reality this is just a micro optimization. Furthermore, `selectScaleOption` is only skipped for the "named" scale values (e.g. `auto`, `page-actual`, `page-fit`, `page-width`), thus further reducing the value of this code.

Also, since we're updating the scale `<select>` dropdown from an event handler, we're currently depending on the event being dispatched (and handled) completely before the next `scalechange` event. Relying on the execution order of the code in this way, even though it currently works, seems unfortunate since it *could* potentially cause the internal scale value and the UI from getting out of sync.
@Snuffleupagus
Copy link
Collaborator Author

/botio-linux preview

@pdfjsbot
Copy link

From: Bot.io (Linux)


Received

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

Live output at: http://107.21.233.14:8877/445ead047cd66b3/output.txt

timvandermeij added a commit that referenced this pull request Jul 11, 2015
…Controls

Remove `PDFViewerApplication.updateScaleControls` (issue 6158)
@timvandermeij timvandermeij merged commit d091263 into mozilla:master Jul 11, 2015
@timvandermeij
Copy link
Contributor

Really nice! Probably the last step is to remove setScale (with the now unused resetAutoSettings) altogether.

@Snuffleupagus Snuffleupagus deleted the viewer-remove-updateScaleControls branch July 11, 2015 15:28
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.

3 participants