[Pkg-javascript-commits] [pdf.js] 114/174: Merge pull request #6073 from Snuffleupagus/bug-1170063

David Prévot taffit at moszumanska.debian.org
Thu Nov 19 18:45:27 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 c8c211602ba90f0700b6c4e10af637d344ee85a6
Merge: c2e70ea 633d51f
Author: Yury Delendik <ydelendik at mozilla.com>
Date:   Fri Oct 30 11:54:04 2015 -0500

    Merge pull request #6073 from Snuffleupagus/bug-1170063
    
    [Firefox] Handle the user modifying the "mousewheel.with_meta.action" and "mousewheel.with_control.action" prefs (bug 1170063)

 extensions/firefox/content/PdfStreamConverter.jsm |  8 +++++++-
 web/viewer.js                                     | 17 +++++++++++++++++
 2 files changed, 24 insertions(+), 1 deletion(-)

diff --cc web/viewer.js
index d14cc50,53d2984..bbe1f66
--- a/web/viewer.js
+++ b/web/viewer.js
@@@ -1898,25 -1857,14 +1910,30 @@@ function handleMouseWheel(evt) 
      PDFViewerApplication.scrollPresentationMode(ticks *
                                                  MOUSE_WHEEL_DELTA_FACTOR);
    } else if (evt.ctrlKey || evt.metaKey) {
+     var support = PDFViewerApplication.supportedMouseWheelZoomModifierKeys;
+     if ((evt.ctrlKey && !support.ctrlKey) ||
+         (evt.metaKey && !support.metaKey)) {
+       return;
+     }
      // Only zoom the pages, not the entire viewer.
      evt.preventDefault();
 +
 +    var previousScale = pdfViewer.currentScale;
 +
      PDFViewerApplication[direction](Math.abs(ticks));
 +
 +    var currentScale = pdfViewer.currentScale;
 +    if (previousScale !== currentScale) {
 +      // After scaling the page via zoomIn/zoomOut, the position of the upper-
 +      // left corner is restored. When the mouse wheel is used, the position
 +      // under the cursor should be restored instead.
 +      var scaleCorrectionFactor = currentScale / previousScale - 1;
 +      var rect = pdfViewer.container.getBoundingClientRect();
 +      var dx = evt.clientX - rect.left;
 +      var dy = evt.clientY - rect.top;
 +      pdfViewer.container.scrollLeft += dx * scaleCorrectionFactor;
 +      pdfViewer.container.scrollTop += dy * scaleCorrectionFactor;
 +    }
    }
  }
  

-- 
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