|
|
@ -14,6 +14,7 @@ |
|
|
|
* See the License for the specific language governing permissions and |
|
|
|
* See the License for the specific language governing permissions and |
|
|
|
* limitations under the License. |
|
|
|
* limitations under the License. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
/* globals PDFJS, PDFBug, FirefoxCom, Stats */ |
|
|
|
|
|
|
|
|
|
|
|
'use strict'; |
|
|
|
'use strict'; |
|
|
|
|
|
|
|
|
|
|
@ -64,7 +65,8 @@ function scrollIntoView(element, spot) { |
|
|
|
// producing the error. See also animationStartedClosure.
|
|
|
|
// producing the error. See also animationStartedClosure.
|
|
|
|
var parent = element.offsetParent, offsetY = element.offsetTop; |
|
|
|
var parent = element.offsetParent, offsetY = element.offsetTop; |
|
|
|
if (!parent) { |
|
|
|
if (!parent) { |
|
|
|
error('offsetParent is not set -- cannot scroll'); |
|
|
|
console.error('offsetParent is not set -- cannot scroll'); |
|
|
|
|
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
while (parent.clientHeight == parent.scrollHeight) { |
|
|
|
while (parent.clientHeight == parent.scrollHeight) { |
|
|
|
offsetY += parent.offsetTop; |
|
|
|
offsetY += parent.offsetTop; |
|
|
@ -2042,8 +2044,9 @@ var PageView = function pageView(container, pdfPage, id, scale, |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
this.draw = function pageviewDraw(callback) { |
|
|
|
this.draw = function pageviewDraw(callback) { |
|
|
|
if (this.renderingState !== RenderingStates.INITIAL) |
|
|
|
if (this.renderingState !== RenderingStates.INITIAL) { |
|
|
|
error('Must be in new state before drawing'); |
|
|
|
console.error('Must be in new state before drawing'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.renderingState = RenderingStates.RUNNING; |
|
|
|
this.renderingState = RenderingStates.RUNNING; |
|
|
|
|
|
|
|
|
|
|
@ -2217,7 +2220,7 @@ var PageView = function pageView(container, pdfPage, id, scale, |
|
|
|
console.error(error); |
|
|
|
console.error(error); |
|
|
|
// Tell the printEngine that rendering this canvas/page has failed.
|
|
|
|
// Tell the printEngine that rendering this canvas/page has failed.
|
|
|
|
// This will make the print proces stop.
|
|
|
|
// This will make the print proces stop.
|
|
|
|
if ('abort' in object) |
|
|
|
if ('abort' in obj) |
|
|
|
obj.abort(); |
|
|
|
obj.abort(); |
|
|
|
else |
|
|
|
else |
|
|
|
obj.done(); |
|
|
|
obj.done(); |
|
|
@ -2299,7 +2302,7 @@ var ThumbnailView = function thumbnailView(container, pdfPage, id) { |
|
|
|
this.hasImage = false; |
|
|
|
this.hasImage = false; |
|
|
|
this.renderingState = RenderingStates.INITIAL; |
|
|
|
this.renderingState = RenderingStates.INITIAL; |
|
|
|
this.resume = null; |
|
|
|
this.resume = null; |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
function getPageDrawContext() { |
|
|
|
function getPageDrawContext() { |
|
|
|
var canvas = document.createElement('canvas'); |
|
|
|
var canvas = document.createElement('canvas'); |
|
|
@ -2329,8 +2332,9 @@ var ThumbnailView = function thumbnailView(container, pdfPage, id) { |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
this.draw = function thumbnailViewDraw(callback) { |
|
|
|
this.draw = function thumbnailViewDraw(callback) { |
|
|
|
if (this.renderingState !== RenderingStates.INITIAL) |
|
|
|
if (this.renderingState !== RenderingStates.INITIAL) { |
|
|
|
error('Must be in new state before drawing'); |
|
|
|
console.error('Must be in new state before drawing'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.renderingState = RenderingStates.RUNNING; |
|
|
|
this.renderingState = RenderingStates.RUNNING; |
|
|
|
if (this.hasImage) { |
|
|
|
if (this.hasImage) { |
|
|
@ -3076,7 +3080,7 @@ window.addEventListener('hashchange', function webViewerHashchange(evt) { |
|
|
|
|
|
|
|
|
|
|
|
window.addEventListener('change', function webViewerChange(evt) { |
|
|
|
window.addEventListener('change', function webViewerChange(evt) { |
|
|
|
var files = evt.target.files; |
|
|
|
var files = evt.target.files; |
|
|
|
if (!files || files.length == 0) |
|
|
|
if (!files || files.length === 0) |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
// Read the local file into a Uint8Array.
|
|
|
|
// Read the local file into a Uint8Array.
|
|
|
@ -3271,7 +3275,7 @@ window.addEventListener('keydown', function keydown(evt) { |
|
|
|
curElement = curElement.parentNode; |
|
|
|
curElement = curElement.parentNode; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (cmd == 0) { // no control key pressed at all.
|
|
|
|
if (cmd === 0) { // no control key pressed at all.
|
|
|
|
switch (evt.keyCode) { |
|
|
|
switch (evt.keyCode) { |
|
|
|
case 38: // up arrow
|
|
|
|
case 38: // up arrow
|
|
|
|
case 33: // pg up
|
|
|
|
case 33: // pg up
|
|
|
@ -3279,12 +3283,14 @@ window.addEventListener('keydown', function keydown(evt) { |
|
|
|
if (!PDFView.isFullscreen && PDFView.currentScaleValue !== 'page-fit') { |
|
|
|
if (!PDFView.isFullscreen && PDFView.currentScaleValue !== 'page-fit') { |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
// in fullscreen mode falls throw here
|
|
|
|
/* in fullscreen mode */ |
|
|
|
|
|
|
|
/* falls through */ |
|
|
|
case 37: // left arrow
|
|
|
|
case 37: // left arrow
|
|
|
|
// horizontal scrolling using arrow keys
|
|
|
|
// horizontal scrolling using arrow keys
|
|
|
|
if (PDFView.isHorizontalScrollbarEnabled) { |
|
|
|
if (PDFView.isHorizontalScrollbarEnabled) { |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/* falls through */ |
|
|
|
case 75: // 'k'
|
|
|
|
case 75: // 'k'
|
|
|
|
case 80: // 'p'
|
|
|
|
case 80: // 'p'
|
|
|
|
PDFView.page--; |
|
|
|
PDFView.page--; |
|
|
@ -3296,12 +3302,13 @@ window.addEventListener('keydown', function keydown(evt) { |
|
|
|
if (!PDFView.isFullscreen && PDFView.currentScaleValue !== 'page-fit') { |
|
|
|
if (!PDFView.isFullscreen && PDFView.currentScaleValue !== 'page-fit') { |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
// in fullscreen mode falls throw here
|
|
|
|
/* falls through */ |
|
|
|
case 39: // right arrow
|
|
|
|
case 39: // right arrow
|
|
|
|
// horizontal scrolling using arrow keys
|
|
|
|
// horizontal scrolling using arrow keys
|
|
|
|
if (PDFView.isHorizontalScrollbarEnabled) { |
|
|
|
if (PDFView.isHorizontalScrollbarEnabled) { |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/* falls through */ |
|
|
|
case 74: // 'j'
|
|
|
|
case 74: // 'j'
|
|
|
|
case 78: // 'n'
|
|
|
|
case 78: // 'n'
|
|
|
|
PDFView.page++; |
|
|
|
PDFView.page++; |
|
|
|