Ensure that the zoom buttons are disabled correctly if the scale is smaller/larger than MIN_SCALE/MAX_SCALE in PDFViewerApplication._updateUIToolbar

In the `zoom{In, Out}` functions in `PDFViewerApplication`, we prevent the zoom value from becoming smaller/larger than `MIN_SCALE/MAX_SCALE`.
However, if the user sets the zoom level through the hash parameter the zoom buttons might not be correctly disabled; try http://mozilla.github.io/pdf.js/web/viewer.html#zoom=10.

Note that this issue has been present since "forever", but given that the solution is so simple I think that we should just fix this. (I'm also fixing a stupid typo I previously made in the JSDoc comment.)
This commit is contained in:
Jonas Jenwald 2016-08-31 13:15:28 +02:00
parent ffa99397ad
commit f3b7fa091d

View File

@ -1211,7 +1211,7 @@ var PDFViewerApplication = {
* @typedef UpdateUIToolbarParameters
* @property {number} pageNumber
* @property {string} scaleValue
* @property {scale} scale
* @property {number} scale
* @property {boolean} resetNumPages
*/
@ -1262,8 +1262,8 @@ var PDFViewerApplication = {
toolbarConfig.firstPage.disabled = (pageNumber <= 1);
toolbarConfig.lastPage.disabled = (pageNumber >= pagesCount);
toolbarConfig.zoomOut.disabled = (scale === MIN_SCALE);
toolbarConfig.zoomIn.disabled = (scale === MAX_SCALE);
toolbarConfig.zoomOut.disabled = (scale <= MIN_SCALE);
toolbarConfig.zoomIn.disabled = (scale >= MAX_SCALE);
selectScaleOption(scaleValue, scale);
},