Merge pull request #3308 from brendandahl/hide-overflow
Hide canvas overflow for high dpi screens.
This commit is contained in:
commit
f700e61e9e
@ -1129,6 +1129,10 @@ html[dir='rtl'] .outlineItem > a {
|
|||||||
bottom: 35px;
|
bottom: 35px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.canvasWrapper {
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
canvas {
|
canvas {
|
||||||
margin: auto;
|
margin: auto;
|
||||||
display: block;
|
display: block;
|
||||||
|
@ -2576,12 +2576,21 @@ var PageView = function pageView(container, id, scale,
|
|||||||
|
|
||||||
this.renderingState = RenderingStates.RUNNING;
|
this.renderingState = RenderingStates.RUNNING;
|
||||||
|
|
||||||
|
var viewport = this.viewport;
|
||||||
|
// Wrap the canvas so if it has a css transform for highdpi the overflow
|
||||||
|
// will be hidden in FF.
|
||||||
|
var canvasWrapper = document.createElement('div');
|
||||||
|
canvasWrapper.style.width = div.style.width;
|
||||||
|
canvasWrapper.style.height = div.style.height;
|
||||||
|
canvasWrapper.classList.add('canvasWrapper');
|
||||||
|
|
||||||
var canvas = document.createElement('canvas');
|
var canvas = document.createElement('canvas');
|
||||||
canvas.id = 'page' + this.id;
|
canvas.id = 'page' + this.id;
|
||||||
div.appendChild(canvas);
|
canvasWrapper.appendChild(canvas);
|
||||||
|
div.appendChild(canvasWrapper);
|
||||||
this.canvas = canvas;
|
this.canvas = canvas;
|
||||||
|
|
||||||
var scale = this.scale, viewport = this.viewport;
|
var scale = this.scale;
|
||||||
var outputScale = PDFView.getOutputScale();
|
var outputScale = PDFView.getOutputScale();
|
||||||
canvas.width = Math.floor(viewport.width) * outputScale.sx;
|
canvas.width = Math.floor(viewport.width) * outputScale.sx;
|
||||||
canvas.height = Math.floor(viewport.height) * outputScale.sy;
|
canvas.height = Math.floor(viewport.height) * outputScale.sy;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user