From be779c2ec740e5cf1587b7816aea840aff601914 Mon Sep 17 00:00:00 2001 From: Yury Delendik Date: Wed, 10 Oct 2012 19:32:48 -0500 Subject: [PATCH] Hides cursor in presentation mode --- web/viewer.css | 9 +++++++++ web/viewer.js | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/web/viewer.css b/web/viewer.css index b57698c37..7f9a83288 100644 --- a/web/viewer.css +++ b/web/viewer.css @@ -50,6 +50,7 @@ select { width: 100%; height: 100%; overflow: hidden; + cursor: none; } #viewerContainer:-moz-full-screen { @@ -60,6 +61,7 @@ select { width: 100%; height: 100%; overflow: hidden; + cursor: none; } :-webkit-full-screen .page:last-child { @@ -72,10 +74,17 @@ select { #viewerContainer:full-screen { top: 0px; + border-top: 5px solid transparent; background-color: #404040; background-image: url(images/texture.png); width: 100%; height: 100%; + overflow: hidden; + cursor: none; +} + +#viewerContainer.presentationControls { + cursor: default; } /* outer/inner center provides horizontal center */ diff --git a/web/viewer.js b/web/viewer.js index 6d0829b6d..df79555b4 100644 --- a/web/viewer.js +++ b/web/viewer.js @@ -1508,6 +1508,7 @@ var PDFView = { currentPage.scrollIntoView(); }, 0); + this.showPresentationControls(); return true; }, @@ -1516,6 +1517,32 @@ var PDFView = { this.parseScale(this.previousScale); this.page = this.page; this.clearMouseScrollState(); + this.hidePresentationControls(); + }, + + showPresentationControls: function pdfViewShowPresentationControls() { + var DELAY_BEFORE_HIDING_CONTROLS = 3000; + var wrapper = document.getElementById('viewerContainer'); + if (this.presentationControlsTimeout) { + clearTimeout(this.presentationControlsTimeout); + } else { + wrapper.classList.add('presentationControls'); + } + this.presentationControlsTimeout = setTimeout(function hideControls() { + wrapper.classList.remove('presentationControls'); + delete PDFView.presentationControlsTimeout; + }, DELAY_BEFORE_HIDING_CONTROLS); + }, + + hidePresentationControls: function pdfViewShowPresentationControls() { + if (!this.presentationControlsTimeout) { + return; + } + clearTimeout(this.presentationControlsTimeout); + delete this.presentationControlsTimeout; + + var wrapper = document.getElementById('viewerContainer'); + wrapper.classList.remove('presentationControls'); }, rotatePages: function pdfViewPageRotation(delta) { @@ -2915,6 +2942,12 @@ window.addEventListener('DOMMouseScroll', function(evt) { } }, false); +window.addEventListener('mousemove', function keydown(evt) { + if (PDFView.isFullscreen) { + PDFView.showPresentationControls(); + } +}, false); + window.addEventListener('mousedown', function mousedown(evt) { if (PDFView.isFullscreen && evt.button === 0) { // Mouse click in fullmode advances a page