Merge pull request #15069 from Snuffleupagus/annotationLayer-dimensions
Ensure that the annotationLayer has the correct dimensions (PR 15036 follow-up)
This commit is contained in:
commit
db6f675baa
@ -2505,18 +2505,19 @@ class AnnotationLayer {
|
|||||||
div.hidden = false;
|
div.hidden = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static setDimensions(div, viewport) {
|
/**
|
||||||
const { width, height, rotation } = viewport;
|
* @param {HTMLDivElement} div
|
||||||
|
* @param {PageViewport} viewport
|
||||||
|
*/
|
||||||
|
static setDimensions(div, { width, height, rotation }) {
|
||||||
const { style } = div;
|
const { style } = div;
|
||||||
|
|
||||||
if (rotation === 0 || rotation === 180) {
|
const flipOrientation = rotation % 180 !== 0,
|
||||||
style.width = `${width}px`;
|
widthStr = Math.floor(width) + "px",
|
||||||
style.height = `${height}px`;
|
heightStr = Math.floor(height) + "px";
|
||||||
} else {
|
|
||||||
style.width = `${height}px`;
|
|
||||||
style.height = `${width}px`;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
style.width = flipOrientation ? heightStr : widthStr;
|
||||||
|
style.height = flipOrientation ? widthStr : heightStr;
|
||||||
div.setAttribute("data-annotation-rotation", rotation);
|
div.setAttribute("data-annotation-rotation", rotation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user