[Pkg-javascript-commits] [pdf.js] 192/204: Disable zooming in Presentation Mode
David Prévot
taffit at moszumanska.debian.org
Sat Oct 25 18:50:50 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository pdf.js.
commit a1f4bff4f38b92df34ede30a5cbb3f54f39ee5ad
Author: Jonas Jenwald <jonas.jenwald at gmail.com>
Date: Wed Oct 15 22:03:13 2014 +0200
Disable zooming in Presentation Mode
---
web/viewer.js | 34 +++++++++++++++++++++++-----------
1 file changed, 23 insertions(+), 11 deletions(-)
diff --git a/web/viewer.js b/web/viewer.js
index 9561469..3a86c3d 100644
--- a/web/viewer.js
+++ b/web/viewer.js
@@ -1964,11 +1964,12 @@ function handleMouseWheel(evt) {
evt.wheelDelta / MOUSE_WHEEL_DELTA_FACTOR;
var direction = (ticks < 0) ? 'zoomOut' : 'zoomIn';
- if (evt.ctrlKey) { // Only zoom the pages, not the entire viewer
+ if (PresentationMode.active) {
evt.preventDefault();
- PDFViewerApplication[direction](Math.abs(ticks));
- } else if (PresentationMode.active) {
PDFViewerApplication.mouseScroll(ticks * MOUSE_WHEEL_DELTA_FACTOR);
+ } else if (evt.ctrlKey) { // Only zoom the pages, not the entire viewer
+ evt.preventDefault();
+ PDFViewerApplication[direction](Math.abs(ticks));
}
}
@@ -2003,6 +2004,11 @@ window.addEventListener('keydown', function keydown(evt) {
// control is selected or not.
if (cmd === 1 || cmd === 8 || cmd === 5 || cmd === 12) {
// either CTRL or META key with optional SHIFT.
+ var pdfViewer = PDFViewerApplication.pdfViewer;
+ var inPresentationMode =
+ pdfViewer.presentationModeState === PresentationModeState.CHANGING ||
+ pdfViewer.presentationModeState === PresentationModeState.FULLSCREEN;
+
switch (evt.keyCode) {
case 70: // f
if (!PDFViewerApplication.supportsIntegratedFind) {
@@ -2021,23 +2027,29 @@ window.addEventListener('keydown', function keydown(evt) {
case 107: // FF '+' and '='
case 187: // Chrome '+'
case 171: // FF with German keyboard
- PDFViewerApplication.zoomIn();
+ if (!inPresentationMode) {
+ PDFViewerApplication.zoomIn();
+ }
handled = true;
break;
case 173: // FF/Mac '-'
case 109: // FF '-'
case 189: // Chrome '-'
- PDFViewerApplication.zoomOut();
+ if (!inPresentationMode) {
+ PDFViewerApplication.zoomOut();
+ }
handled = true;
break;
case 48: // '0'
case 96: // '0' on Numpad of Swedish keyboard
- // keeping it unhandled (to restore page zoom to 100%)
- setTimeout(function () {
- // ... and resetting the scale after browser adjusts its scale
- PDFViewerApplication.setScale(DEFAULT_SCALE, true);
- });
- handled = false;
+ if (!inPresentationMode) {
+ // keeping it unhandled (to restore page zoom to 100%)
+ setTimeout(function () {
+ // ... and resetting the scale after browser adjusts its scale
+ PDFViewerApplication.setScale(DEFAULT_SCALE, true);
+ });
+ handled = false;
+ }
break;
}
}
--
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