Using pdfjs-dist as a library for b2g viewer.
This commit is contained in:
parent
1da0b3a363
commit
1b847df2f3
8 changed files with 400 additions and 240 deletions
|
@ -18,7 +18,7 @@
|
|||
SCROLLBAR_PADDING, VERTICAL_PADDING, MAX_AUTO_SCALE, CSS_UNITS,
|
||||
DEFAULT_SCALE, scrollIntoView, getVisibleElements, RenderingStates,
|
||||
PDFJS, Promise, TextLayerBuilder, PDFRenderingQueue,
|
||||
AnnotationsLayerBuilder */
|
||||
AnnotationsLayerBuilder, DEFAULT_SCALE_VALUE */
|
||||
|
||||
'use strict';
|
||||
|
||||
|
@ -149,7 +149,8 @@ var PDFViewer = (function pdfViewer() {
|
|||
* @returns {number}
|
||||
*/
|
||||
get currentScale() {
|
||||
return this._currentScale;
|
||||
return this._currentScale !== UNKNOWN_SCALE ? this._currentScale :
|
||||
DEFAULT_SCALE;
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -161,7 +162,7 @@ var PDFViewer = (function pdfViewer() {
|
|||
}
|
||||
if (!this.pdfDocument) {
|
||||
this._currentScale = val;
|
||||
this._currentScaleValue = val.toString();
|
||||
this._currentScaleValue = val !== UNKNOWN_SCALE ? val.toString() : null;
|
||||
return;
|
||||
}
|
||||
this._setScale(val, false);
|
||||
|
@ -265,7 +266,7 @@ var PDFViewer = (function pdfViewer() {
|
|||
// Fetch a single page so we can get a viewport that will be the default
|
||||
// viewport for all pages
|
||||
return firstPagePromise.then(function(pdfPage) {
|
||||
var scale = this._currentScale || 1.0;
|
||||
var scale = this.currentScale;
|
||||
var viewport = pdfPage.getViewport(scale * CSS_UNITS);
|
||||
for (var pageNum = 1; pageNum <= pagesCount; ++pageNum) {
|
||||
var textLayerFactory = null;
|
||||
|
@ -523,10 +524,10 @@ var PDFViewer = (function pdfViewer() {
|
|||
return;
|
||||
}
|
||||
|
||||
if (scale && scale !== this.currentScale) {
|
||||
if (scale && scale !== this._currentScale) {
|
||||
this.currentScaleValue = scale;
|
||||
} else if (this.currentScale === UNKNOWN_SCALE) {
|
||||
this.currentScaleValue = DEFAULT_SCALE;
|
||||
} else if (this._currentScale === UNKNOWN_SCALE) {
|
||||
this.currentScaleValue = DEFAULT_SCALE_VALUE;
|
||||
}
|
||||
|
||||
if (scale === 'page-fit' && !dest[4]) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue