From f3b7fa091dadd84bf51417152450fb0c01e2e9c8 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Wed, 31 Aug 2016 13:15:28 +0200 Subject: [PATCH] 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.) --- web/app.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/web/app.js b/web/app.js index accfb1e990737..b38fc6ec32885 100644 --- a/web/app.js +++ b/web/app.js @@ -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); },