[Pkg-javascript-commits] [pdf.js] 339/414: Disables zooming when the stream of events that don't have meta/ctrl keys active at the outset, for 1000ms
David Prévot
taffit at moszumanska.debian.org
Tue Jun 28 17:12:37 UTC 2016
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository pdf.js.
commit 6878d7c6d3e7b791bdb9944ab2d0b99387bc2206
Author: Manas <prometheansacrifice at gmail.com>
Date: Thu Apr 7 22:18:46 2016 +0530
Disables zooming when the stream of events that don't have meta/ctrl
keys active at the outset, for 1000ms
---
web/app.js | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/web/app.js b/web/app.js
index 0f65a88..bb489b0 100644
--- a/web/app.js
+++ b/web/app.js
@@ -1823,6 +1823,7 @@ window.addEventListener('pagechange', function pagechange(evt) {
}
}, true);
+var zoomDisabled = false, zoomDisabledTimeout;
function handleMouseWheel(evt) {
var MOUSE_WHEEL_DELTA_FACTOR = 40;
var ticks = (evt.type === 'DOMMouseScroll') ? -evt.detail :
@@ -1837,7 +1838,8 @@ function handleMouseWheel(evt) {
} else if (evt.ctrlKey || evt.metaKey) {
var support = PDFViewerApplication.supportedMouseWheelZoomModifierKeys;
if ((evt.ctrlKey && !support.ctrlKey) ||
- (evt.metaKey && !support.metaKey)) {
+ (evt.metaKey && !support.metaKey) ||
+ zoomDisabled) {
return;
}
// Only zoom the pages, not the entire viewer.
@@ -1859,6 +1861,12 @@ function handleMouseWheel(evt) {
pdfViewer.container.scrollLeft += dx * scaleCorrectionFactor;
pdfViewer.container.scrollTop += dy * scaleCorrectionFactor;
}
+ } else {
+ zoomDisabled = true;
+ clearTimeout(zoomDisabledTimeout);
+ zoomDisabledTimeout = setTimeout(function () {
+ zoomDisabled = false;
+ }, 1000);
}
}
--
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