Hides cursor in presentation mode

This commit is contained in:
Yury Delendik 2012-10-10 19:32:48 -05:00
parent 5fb48d3441
commit be779c2ec7
2 changed files with 42 additions and 0 deletions

View File

@ -50,6 +50,7 @@ select {
width: 100%; width: 100%;
height: 100%; height: 100%;
overflow: hidden; overflow: hidden;
cursor: none;
} }
#viewerContainer:-moz-full-screen { #viewerContainer:-moz-full-screen {
@ -60,6 +61,7 @@ select {
width: 100%; width: 100%;
height: 100%; height: 100%;
overflow: hidden; overflow: hidden;
cursor: none;
} }
:-webkit-full-screen .page:last-child { :-webkit-full-screen .page:last-child {
@ -72,10 +74,17 @@ select {
#viewerContainer:full-screen { #viewerContainer:full-screen {
top: 0px; top: 0px;
border-top: 5px solid transparent;
background-color: #404040; background-color: #404040;
background-image: url(images/texture.png); background-image: url(images/texture.png);
width: 100%; width: 100%;
height: 100%; height: 100%;
overflow: hidden;
cursor: none;
}
#viewerContainer.presentationControls {
cursor: default;
} }
/* outer/inner center provides horizontal center */ /* outer/inner center provides horizontal center */

View File

@ -1508,6 +1508,7 @@ var PDFView = {
currentPage.scrollIntoView(); currentPage.scrollIntoView();
}, 0); }, 0);
this.showPresentationControls();
return true; return true;
}, },
@ -1516,6 +1517,32 @@ var PDFView = {
this.parseScale(this.previousScale); this.parseScale(this.previousScale);
this.page = this.page; this.page = this.page;
this.clearMouseScrollState(); 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) { rotatePages: function pdfViewPageRotation(delta) {
@ -2915,6 +2942,12 @@ window.addEventListener('DOMMouseScroll', function(evt) {
} }
}, false); }, false);
window.addEventListener('mousemove', function keydown(evt) {
if (PDFView.isFullscreen) {
PDFView.showPresentationControls();
}
}, false);
window.addEventListener('mousedown', function mousedown(evt) { window.addEventListener('mousedown', function mousedown(evt) {
if (PDFView.isFullscreen && evt.button === 0) { if (PDFView.isFullscreen && evt.button === 0) {
// Mouse click in fullmode advances a page // Mouse click in fullmode advances a page