@ -174,7 +174,6 @@ var PDFViewerApplication = {
@@ -174,7 +174,6 @@ var PDFViewerApplication = {
SecondaryToolbar . initialize ( {
toolbar : document . getElementById ( 'secondaryToolbar' ) ,
presentationMode : PresentationMode ,
toggleButton : document . getElementById ( 'secondaryToolbarToggle' ) ,
presentationModeButton :
document . getElementById ( 'secondaryPresentationMode' ) ,
@ -190,14 +189,16 @@ var PDFViewerApplication = {
@@ -190,14 +189,16 @@ var PDFViewerApplication = {
documentPropertiesButton : document . getElementById ( 'documentProperties' )
} ) ;
PresentationMode . initialize ( {
container : container ,
secondaryToolbar : SecondaryToolbar ,
firstPage : document . getElementById ( 'contextFirstPage' ) ,
lastPage : document . getElementById ( 'contextLastPage' ) ,
pageRotateCw : document . getElementById ( 'contextPageRotateCw' ) ,
pageRotateCcw : document . getElementById ( 'contextPageRotateCcw' )
} ) ;
if ( this . supportsFullscreen ) {
PresentationMode . initialize ( {
container : container ,
secondaryToolbar : SecondaryToolbar ,
firstPage : document . getElementById ( 'contextFirstPage' ) ,
lastPage : document . getElementById ( 'contextLastPage' ) ,
pageRotateCw : document . getElementById ( 'contextPageRotateCw' ) ,
pageRotateCcw : document . getElementById ( 'contextPageRotateCcw' )
} ) ;
}
PasswordPrompt . initialize ( {
overlayName : 'passwordOverlay' ,
@ -1334,6 +1335,13 @@ var PDFViewerApplication = {
@@ -1334,6 +1335,13 @@ var PDFViewerApplication = {
this . pdfViewer . scrollPageIntoView ( pageNumber ) ;
} ,
requestPresentationMode : function pdfViewRequestPresentationMode ( ) {
if ( ! this . supportsFullscreen ) {
return ;
}
PresentationMode . request ( ) ;
} ,
/ * *
* This function flips the page in presentation mode if the user scrolls up
* or down with large enough motion and prevents page flipping too often .
@ -1976,7 +1984,7 @@ function handleMouseWheel(evt) {
@@ -1976,7 +1984,7 @@ function handleMouseWheel(evt) {
evt . wheelDelta / MOUSE _WHEEL _DELTA _FACTOR ;
var direction = ( ticks < 0 ) ? 'zoomOut' : 'zoomIn' ;
if ( PresentationMode . activ e ) {
if ( PDFViewerApplication . pdfViewer . isInPresentationMod e ) {
evt . preventDefault ( ) ;
PDFViewerApplication . mouseScroll ( ticks * MOUSE _WHEEL _DELTA _FACTOR ) ;
} else if ( evt . ctrlKey || evt . metaKey ) {
@ -1990,9 +1998,9 @@ window.addEventListener('DOMMouseScroll', handleMouseWheel);
@@ -1990,9 +1998,9 @@ window.addEventListener('DOMMouseScroll', handleMouseWheel);
window . addEventListener ( 'mousewheel' , handleMouseWheel ) ;
window . addEventListener ( 'click' , function click ( evt ) {
if ( ! PresentationMode . activ e ) {
if ( ! PDFViewerApplication . pdfViewer . isInPresentationMod e ) {
if ( SecondaryToolbar . opened &&
PDFViewerApplication . pdfViewer . containsElement ( evt . target ) ) {
PDFViewerApplication . pdfViewer . containsElement ( evt . target ) ) {
SecondaryToolbar . close ( ) ;
}
} else if ( evt . button === 0 ) {
@ -2013,15 +2021,13 @@ window.addEventListener('keydown', function keydown(evt) {
@@ -2013,15 +2021,13 @@ window.addEventListener('keydown', function keydown(evt) {
( evt . shiftKey ? 4 : 0 ) |
( evt . metaKey ? 8 : 0 ) ;
var pdfViewer = PDFViewerApplication . pdfViewer ;
var isViewerInPresentationMode = pdfViewer && pdfViewer . isInPresentationMode ;
// First, handle the key bindings that are independent whether an input
// 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 &&
( pdfViewer . presentationModeState === PresentationModeState . CHANGING ||
pdfViewer . presentationModeState === PresentationModeState . FULLSCREEN ) ;
switch ( evt . keyCode ) {
case 70 : // f
if ( ! PDFViewerApplication . supportsIntegratedFind ) {
@ -2040,7 +2046,7 @@ window.addEventListener('keydown', function keydown(evt) {
@@ -2040,7 +2046,7 @@ window.addEventListener('keydown', function keydown(evt) {
case 107 : // FF '+' and '='
case 187 : // Chrome '+'
case 171 : // FF with German keyboard
if ( ! inPresentationMode ) {
if ( ! isViewerI nPresentationMode ) {
PDFViewerApplication . zoomIn ( ) ;
}
handled = true ;
@ -2048,14 +2054,14 @@ window.addEventListener('keydown', function keydown(evt) {
@@ -2048,14 +2054,14 @@ window.addEventListener('keydown', function keydown(evt) {
case 173 : // FF/Mac '-'
case 109 : // FF '-'
case 189 : // Chrome '-'
if ( ! inPresentationMode ) {
if ( ! isViewerI nPresentationMode ) {
PDFViewerApplication . zoomOut ( ) ;
}
handled = true ;
break ;
case 48 : // '0'
case 96 : // '0' on Numpad of Swedish keyboard
if ( ! inPresentationMode ) {
if ( ! isViewerI nPresentationMode ) {
// keeping it unhandled (to restore page zoom to 100%)
setTimeout ( function ( ) {
// ... and resetting the scale after browser adjusts its scale
@ -2083,7 +2089,7 @@ window.addEventListener('keydown', function keydown(evt) {
@@ -2083,7 +2089,7 @@ window.addEventListener('keydown', function keydown(evt) {
if ( cmd === 3 || cmd === 10 ) {
switch ( evt . keyCode ) {
case 80 : // p
SecondaryToolbar . presentationModeClick ( ) ;
PDFViewerApplication . requestPresentationMode ( ) ;
handled = true ;
break ;
case 71 : // g
@ -2117,15 +2123,15 @@ window.addEventListener('keydown', function keydown(evt) {
@@ -2117,15 +2123,15 @@ window.addEventListener('keydown', function keydown(evt) {
case 38 : // up arrow
case 33 : // pg up
case 8 : // backspace
if ( ! PresentationMode . activ e &&
PDFViewerApplication . currentScaleValue !== 'page-fit' ) {
if ( ! isViewerIn PresentationMode &&
PDFViewerApplication . currentScaleValue !== 'page-fit' ) {
break ;
}
/* in presentation mode */
/* falls through */
case 37 : // left arrow
// horizontal scrolling using arrow keys
if ( PDFViewerApplication . pdfViewer . isHorizontalScrollbarEnabled ) {
if ( pdfViewer . isHorizontalScrollbarEnabled ) {
break ;
}
/* falls through */
@ -2148,14 +2154,14 @@ window.addEventListener('keydown', function keydown(evt) {
@@ -2148,14 +2154,14 @@ window.addEventListener('keydown', function keydown(evt) {
case 40 : // down arrow
case 34 : // pg down
case 32 : // spacebar
if ( ! PresentationMode . activ e &&
if ( ! isViewerIn PresentationMode &&
PDFViewerApplication . currentScaleValue !== 'page-fit' ) {
break ;
}
/* falls through */
case 39 : // right arrow
// horizontal scrolling using arrow keys
if ( PDFViewerApplication . pdfViewer . isHorizontalScrollbarEnabled ) {
if ( pdfViewer . isHorizontalScrollbarEnabled ) {
break ;
}
/* falls through */
@ -2166,13 +2172,13 @@ window.addEventListener('keydown', function keydown(evt) {
@@ -2166,13 +2172,13 @@ window.addEventListener('keydown', function keydown(evt) {
break ;
case 36 : // home
if ( PresentationMode . activ e || PDFViewerApplication . page > 1 ) {
if ( isViewerIn PresentationMode || PDFViewerApplication . page > 1 ) {
PDFViewerApplication . page = 1 ;
handled = true ;
}
break ;
case 35 : // end
if ( PresentationMode . activ e || ( PDFViewerApplication . pdfDocument &&
if ( isViewerIn PresentationMode || ( PDFViewerApplication . pdfDocument &&
PDFViewerApplication . page < PDFViewerApplication . pagesCount ) ) {
PDFViewerApplication . page = PDFViewerApplication . pagesCount ;
handled = true ;
@ -2180,7 +2186,7 @@ window.addEventListener('keydown', function keydown(evt) {
@@ -2180,7 +2186,7 @@ window.addEventListener('keydown', function keydown(evt) {
break ;
case 72 : // 'h'
if ( ! PresentationMode . activ e ) {
if ( ! isViewerIn PresentationMode) {
HandTool . toggle ( ) ;
}
break ;
@ -2193,7 +2199,7 @@ window.addEventListener('keydown', function keydown(evt) {
@@ -2193,7 +2199,7 @@ window.addEventListener('keydown', function keydown(evt) {
if ( cmd === 4 ) { // shift-key
switch ( evt . keyCode ) {
case 32 : // spacebar
if ( ! PresentationMode . activ e &&
if ( ! isViewerIn PresentationMode &&
PDFViewerApplication . currentScaleValue !== 'page-fit' ) {
break ;
}
@ -2207,25 +2213,25 @@ window.addEventListener('keydown', function keydown(evt) {
@@ -2207,25 +2213,25 @@ window.addEventListener('keydown', function keydown(evt) {
}
}
if ( ! handled && ! PresentationMode . activ e ) {
if ( ! handled && ! isViewerIn PresentationMode) {
// 33=Page Up 34=Page Down 35=End 36=Home
// 37=Left 38=Up 39=Right 40=Down
if ( evt . keyCode >= 33 && evt . keyCode <= 40 &&
! PDFViewerApplication . pdfViewer . containsElement ( curElement ) ) {
! pdfViewer . containsElement ( curElement ) ) {
// The page container is not focused, but a page navigation key has been
// pressed. Change the focus to the viewer container to make sure that
// navigation by keyboard works as expected.
PDFViewerApplication . pdfViewer . focus ( ) ;
pdfViewer . focus ( ) ;
}
// 32=Spacebar
if ( evt . keyCode === 32 && curElementTagName !== 'BUTTON' ) {
//#if (FIREFOX || MOZCENTRAL)
// // Workaround for issue in Firefox, that prevents scroll keys from
// // working when elements with 'tabindex' are focused. (#3498)
// PDFViewerApplication. pdfViewer.blur();
// pdfViewer.blur();
//#else
if ( ! PDFViewerApplication . pdfViewer . containsElement ( curElement ) ) {
PDFViewerApplication . pdfViewer . focus ( ) ;
if ( ! pdfViewer . containsElement ( curElement ) ) {
pdfViewer . focus ( ) ;
}
//#endif
}
@ -2234,13 +2240,13 @@ window.addEventListener('keydown', function keydown(evt) {
@@ -2234,13 +2240,13 @@ window.addEventListener('keydown', function keydown(evt) {
if ( cmd === 2 ) { // alt-key
switch ( evt . keyCode ) {
case 37 : // left arrow
if ( PresentationMode . activ e ) {
if ( isViewerIn PresentationMode) {
PDFHistory . back ( ) ;
handled = true ;
}
break ;
case 39 : // right arrow
if ( PresentationMode . activ e ) {
if ( isViewerIn PresentationMode) {
PDFHistory . forward ( ) ;
handled = true ;
}