[Pkg-javascript-commits] [pdf.js] 09/72: Fix regression that prevents resetting the zoom level to "Automatic" when using the |Ctrl + 0| keys

David Prévot taffit at moszumanska.debian.org
Wed Mar 18 20:15:54 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository pdf.js.

commit a495ab0d132f5e1f48e850d786578a1e0e8fe3e1
Author: Jonas Jenwald <jonas.jenwald at gmail.com>
Date:   Thu Feb 19 17:30:47 2015 +0100

    Fix regression that prevents resetting the zoom level to "Automatic" when using the |Ctrl + 0| keys
---
 web/pdf_viewer.js | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/web/pdf_viewer.js b/web/pdf_viewer.js
index 6e2acd3..9df6237 100644
--- a/web/pdf_viewer.js
+++ b/web/pdf_viewer.js
@@ -335,12 +335,27 @@ var PDFViewer = (function pdfViewer() {
       }
     },
 
+    _setScaleDispatchEvent: function pdfViewer_setScaleDispatchEvent(
+        newScale, newValue, preset) {
+      var event = document.createEvent('UIEvents');
+      event.initUIEvent('scalechange', true, true, window, 0);
+      event.scale = newScale;
+      if (preset) {
+        event.presetValue = newValue;
+      }
+      this.container.dispatchEvent(event);
+    },
+
     _setScaleUpdatePages: function pdfViewer_setScaleUpdatePages(
         newScale, newValue, noScroll, preset) {
       this._currentScaleValue = newValue;
       if (newScale === this._currentScale) {
+        if (preset) {
+          this._setScaleDispatchEvent(newScale, newValue, true);
+        }
         return;
       }
+
       for (var i = 0, ii = this.pages.length; i < ii; i++) {
         this.pages[i].update(newScale);
       }
@@ -360,13 +375,7 @@ var PDFViewer = (function pdfViewer() {
         this.scrollPageIntoView(page, dest);
       }
 
-      var event = document.createEvent('UIEvents');
-      event.initUIEvent('scalechange', true, true, window, 0);
-      event.scale = newScale;
-      if (preset) {
-        event.presetValue = newValue;
-      }
-      this.container.dispatchEvent(event);
+      this._setScaleDispatchEvent(newScale, newValue, preset);
     },
 
     _setScale: function pdfViewer_setScale(value, noScroll) {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/pdf.js.git



More information about the Pkg-javascript-commits mailing list