|
|
@ -29,6 +29,7 @@ var PageView = function pageView(container, id, scale, |
|
|
|
this.scale = scale || 1.0; |
|
|
|
this.scale = scale || 1.0; |
|
|
|
this.viewport = defaultViewport; |
|
|
|
this.viewport = defaultViewport; |
|
|
|
this.pdfPageRotate = defaultViewport.rotation; |
|
|
|
this.pdfPageRotate = defaultViewport.rotation; |
|
|
|
|
|
|
|
this.hasRestrictedScaling = false; |
|
|
|
|
|
|
|
|
|
|
|
this.renderingState = RenderingStates.INITIAL; |
|
|
|
this.renderingState = RenderingStates.INITIAL; |
|
|
|
this.resume = null; |
|
|
|
this.resume = null; |
|
|
@ -125,8 +126,23 @@ var PageView = function pageView(container, id, scale, |
|
|
|
rotation: totalRotation |
|
|
|
rotation: totalRotation |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
if (PDFJS.useOnlyCssZoom && this.canvas) { |
|
|
|
var isScalingRestricted = false; |
|
|
|
this.cssTransform(this.canvas); |
|
|
|
if (this.canvas && PDFJS.maxCanvasPixels > 0) { |
|
|
|
|
|
|
|
var ctx = this.canvas.getContext('2d'); |
|
|
|
|
|
|
|
var outputScale = getOutputScale(ctx); |
|
|
|
|
|
|
|
var pixelsInViewport = this.viewport.width * this.viewport.height; |
|
|
|
|
|
|
|
var maxScale = Math.sqrt(PDFJS.maxCanvasPixels / pixelsInViewport); |
|
|
|
|
|
|
|
if (((Math.floor(this.viewport.width) * outputScale.sx) | 0) * |
|
|
|
|
|
|
|
((Math.floor(this.viewport.height) * outputScale.sy) | 0) > |
|
|
|
|
|
|
|
PDFJS.maxCanvasPixels) { |
|
|
|
|
|
|
|
isScalingRestricted = true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (this.canvas && |
|
|
|
|
|
|
|
(PDFJS.useOnlyCssZoom || |
|
|
|
|
|
|
|
(this.hasRestrictedScaling && isScalingRestricted))) { |
|
|
|
|
|
|
|
this.cssTransform(this.canvas, true); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} else if (this.canvas && !this.zoomLayer) { |
|
|
|
} else if (this.canvas && !this.zoomLayer) { |
|
|
|
this.zoomLayer = this.canvas.parentNode; |
|
|
|
this.zoomLayer = this.canvas.parentNode; |
|
|
@ -138,7 +154,7 @@ var PageView = function pageView(container, id, scale, |
|
|
|
this.reset(true); |
|
|
|
this.reset(true); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
this.cssTransform = function pageCssTransform(canvas) { |
|
|
|
this.cssTransform = function pageCssTransform(canvas, redrawAnnotations) { |
|
|
|
// Scale canvas, canvas wrapper, and page container.
|
|
|
|
// Scale canvas, canvas wrapper, and page container.
|
|
|
|
var width = this.viewport.width; |
|
|
|
var width = this.viewport.width; |
|
|
|
var height = this.viewport.height; |
|
|
|
var height = this.viewport.height; |
|
|
@ -201,7 +217,7 @@ var PageView = function pageView(container, id, scale, |
|
|
|
CustomStyle.setProp('transformOrigin', textLayerDiv, '0% 0%'); |
|
|
|
CustomStyle.setProp('transformOrigin', textLayerDiv, '0% 0%'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (PDFJS.useOnlyCssZoom && this.annotationLayer) { |
|
|
|
if (redrawAnnotations && this.annotationLayer) { |
|
|
|
setupAnnotations(div, this.pdfPage, this.viewport); |
|
|
|
setupAnnotations(div, this.pdfPage, this.viewport); |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
@ -507,6 +523,19 @@ var PageView = function pageView(container, id, scale, |
|
|
|
outputScale.scaled = true; |
|
|
|
outputScale.scaled = true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (PDFJS.maxCanvasPixels > 0) { |
|
|
|
|
|
|
|
var pixelsInViewport = viewport.width * viewport.height; |
|
|
|
|
|
|
|
var maxScale = Math.sqrt(PDFJS.maxCanvasPixels / pixelsInViewport); |
|
|
|
|
|
|
|
if (outputScale.sx > maxScale || outputScale.sy > maxScale) { |
|
|
|
|
|
|
|
outputScale.sx = maxScale; |
|
|
|
|
|
|
|
outputScale.sy = maxScale; |
|
|
|
|
|
|
|
outputScale.scaled = true; |
|
|
|
|
|
|
|
this.hasRestrictedScaling = true; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
this.hasRestrictedScaling = false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
canvas.width = (Math.floor(viewport.width) * outputScale.sx) | 0; |
|
|
|
canvas.width = (Math.floor(viewport.width) * outputScale.sx) | 0; |
|
|
|
canvas.height = (Math.floor(viewport.height) * outputScale.sy) | 0; |
|
|
|
canvas.height = (Math.floor(viewport.height) * outputScale.sy) | 0; |
|
|
|
canvas.style.width = Math.floor(viewport.width) + 'px'; |
|
|
|
canvas.style.width = Math.floor(viewport.width) + 'px'; |
|
|
|