Preface all "fullscreen" CSS rules with a |pdfPresentationMode| class, and add it to the |viewerContainer| while Presentation Mode is active

This commit is contained in:
Jonas Jenwald 2015-02-04 14:10:45 +01:00
parent 4211df63eb
commit 601bd4a930
3 changed files with 29 additions and 22 deletions

View File

@ -20,7 +20,8 @@
var DELAY_BEFORE_RESETTING_SWITCH_IN_PROGRESS = 1500; // in ms var DELAY_BEFORE_RESETTING_SWITCH_IN_PROGRESS = 1500; // in ms
var DELAY_BEFORE_HIDING_CONTROLS = 3000; // in ms var DELAY_BEFORE_HIDING_CONTROLS = 3000; // in ms
var SELECTOR = 'presentationControls'; var ACTIVE_SELECTOR = 'pdfPresentationMode';
var CONTROLS_SELECTOR = 'pdfPresentationModeControls';
/** /**
* @typedef {Object} PDFPresentationModeOptions * @typedef {Object} PDFPresentationModeOptions
@ -201,6 +202,7 @@ var PDFPresentationMode = (function PDFPresentationModeClosure() {
this.active = true; this.active = true;
this._resetSwitchInProgress(); this._resetSwitchInProgress();
this._notifyStateChange(); this._notifyStateChange();
this.container.classList.add(ACTIVE_SELECTOR);
// Ensure that the correct page is scrolled into view when entering // Ensure that the correct page is scrolled into view when entering
// Presentation Mode, by waiting until fullscreen mode in enabled. // Presentation Mode, by waiting until fullscreen mode in enabled.
@ -225,6 +227,7 @@ var PDFPresentationMode = (function PDFPresentationModeClosure() {
*/ */
_exit: function PDFPresentationMode_exit() { _exit: function PDFPresentationMode_exit() {
var page = PDFViewerApplication.page; var page = PDFViewerApplication.page;
this.container.classList.remove(ACTIVE_SELECTOR);
// Ensure that the correct page is scrolled into view when exiting // Ensure that the correct page is scrolled into view when exiting
// Presentation Mode, by waiting until fullscreen mode is disabled. // Presentation Mode, by waiting until fullscreen mode is disabled.
@ -285,10 +288,10 @@ var PDFPresentationMode = (function PDFPresentationModeClosure() {
if (this.controlsTimeout) { if (this.controlsTimeout) {
clearTimeout(this.controlsTimeout); clearTimeout(this.controlsTimeout);
} else { } else {
this.container.classList.add(SELECTOR); this.container.classList.add(CONTROLS_SELECTOR);
} }
this.controlsTimeout = setTimeout(function showControlsTimeout() { this.controlsTimeout = setTimeout(function showControlsTimeout() {
this.container.classList.remove(SELECTOR); this.container.classList.remove(CONTROLS_SELECTOR);
delete this.controlsTimeout; delete this.controlsTimeout;
}.bind(this), DELAY_BEFORE_HIDING_CONTROLS); }.bind(this), DELAY_BEFORE_HIDING_CONTROLS);
}, },
@ -301,7 +304,7 @@ var PDFPresentationMode = (function PDFPresentationModeClosure() {
return; return;
} }
clearTimeout(this.controlsTimeout); clearTimeout(this.controlsTimeout);
this.container.classList.remove(SELECTOR); this.container.classList.remove(CONTROLS_SELECTOR);
delete this.controlsTimeout; delete this.controlsTimeout;
}, },

View File

@ -57,22 +57,22 @@
box-shadow: 0px 2px 10px #ff0; box-shadow: 0px 2px 10px #ff0;
} }
:-webkit-full-screen .pdfViewer .page { .pdfPresentationMode:-webkit-full-screen .pdfViewer .page {
margin-bottom: 100%; margin-bottom: 100%;
border: 0; border: 0;
} }
:-moz-full-screen .pdfViewer .page { .pdfPresentationMode:-moz-full-screen .pdfViewer .page {
margin-bottom: 100%; margin-bottom: 100%;
border: 0; border: 0;
} }
:-ms-fullscreen .pdfViewer .page { .pdfPresentationMode:-ms-fullscreen .pdfViewer .page {
margin-bottom: 100% !important; margin-bottom: 100% !important;
border: 0; border: 0;
} }
:fullscreen .pdfViewer .page { .pdfPresentationMode:fullscreen .pdfViewer .page {
margin-bottom: 100%; margin-bottom: 100%;
border: 0; border: 0;
} }

View File

@ -47,7 +47,7 @@ select {
display: none !important; display: none !important;
} }
#viewerContainer:-webkit-full-screen { #viewerContainer.pdfPresentationMode:-webkit-full-screen {
top: 0px; top: 0px;
border-top: 2px solid transparent; border-top: 2px solid transparent;
background-color: #000; background-color: #000;
@ -58,7 +58,7 @@ select {
-webkit-user-select: none; -webkit-user-select: none;
} }
#viewerContainer:-moz-full-screen { #viewerContainer.pdfPresentationMode:-moz-full-screen {
top: 0px; top: 0px;
border-top: 2px solid transparent; border-top: 2px solid transparent;
background-color: #000; background-color: #000;
@ -69,7 +69,7 @@ select {
-moz-user-select: none; -moz-user-select: none;
} }
#viewerContainer:-ms-fullscreen { #viewerContainer.pdfPresentationMode:-ms-fullscreen {
top: 0px !important; top: 0px !important;
border-top: 2px solid transparent; border-top: 2px solid transparent;
width: 100%; width: 100%;
@ -79,11 +79,11 @@ select {
-ms-user-select: none; -ms-user-select: none;
} }
#viewerContainer:-ms-fullscreen::-ms-backdrop { #viewerContainer.pdfPresentationMode:-ms-fullscreen::-ms-backdrop {
background-color: #000; background-color: #000;
} }
#viewerContainer:fullscreen { #viewerContainer.pdfPresentationMode:fullscreen {
top: 0px; top: 0px;
border-top: 2px solid transparent; border-top: 2px solid transparent;
background-color: #000; background-color: #000;
@ -96,36 +96,40 @@ select {
-ms-user-select: none; -ms-user-select: none;
} }
:-webkit-full-screen a:not(.internalLink) { .pdfPresentationMode:-webkit-full-screen a:not(.internalLink) {
display: none; display: none;
} }
:-moz-full-screen a:not(.internalLink) { .pdfPresentationMode:-moz-full-screen a:not(.internalLink) {
display: none; display: none;
} }
:-ms-fullscreen a:not(.internalLink) { .pdfPresentationMode:-ms-fullscreen a:not(.internalLink) {
display: none !important; display: none !important;
} }
:fullscreen a:not(.internalLink) { .pdfPresentationMode:fullscreen a:not(.internalLink) {
display: none; display: none;
} }
:-webkit-full-screen .textLayer > div { .pdfPresentationMode:-webkit-full-screen .textLayer > div {
cursor: none; cursor: none;
} }
:-moz-full-screen .textLayer > div { .pdfPresentationMode:-moz-full-screen .textLayer > div {
cursor: none; cursor: none;
} }
:fullscreen .textLayer > div { .pdfPresentationMode:-ms-fullscreen .textLayer > div {
cursor: none; cursor: none;
} }
#viewerContainer.presentationControls, .pdfPresentationMode:fullscreen .textLayer > div {
#viewerContainer.presentationControls .textLayer > div { cursor: none;
}
.pdfPresentationMode.pdfPresentationModeControls > *,
.pdfPresentationMode.pdfPresentationModeControls .textLayer > div {
cursor: default; cursor: default;
} }