Merge pull request #12409 from Snuffleupagus/bug-1627030

Compute the `transformOrigin` correctly, for negative values, when rendering `AnnotationElement`s (bug 1627030)
This commit is contained in:
Tim van der Meij 2020-09-24 23:48:21 +02:00 committed by GitHub
commit 120c5c2261
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 7 deletions

View File

@ -177,7 +177,7 @@ class AnnotationElement {
]);
container.style.transform = `matrix(${viewport.transform.join(",")})`;
container.style.transformOrigin = `-${rect[0]}px -${rect[1]}px`;
container.style.transformOrigin = `${-rect[0]}px ${-rect[1]}px`;
if (!ignoreBorder && data.borderStyle.width > 0) {
container.style.borderWidth = `${data.borderStyle.width}px`;
@ -763,12 +763,13 @@ class PopupAnnotationElement extends AnnotationElement {
// Position the popup next to the parent annotation's container.
// PDF viewers ignore a popup annotation's rectangle.
const parentLeft = parseFloat(parentElement.style.left);
const parentWidth = parseFloat(parentElement.style.width);
this.container.style.transformOrigin = `-${parentLeft + parentWidth}px -${
parentElement.style.top
}`;
this.container.style.left = `${parentLeft + parentWidth}px`;
const parentTop = parseFloat(parentElement.style.top),
parentLeft = parseFloat(parentElement.style.left),
parentWidth = parseFloat(parentElement.style.width);
const popupLeft = parentLeft + parentWidth;
this.container.style.transformOrigin = `${-popupLeft}px ${-parentTop}px`;
this.container.style.left = `${popupLeft}px`;
this.container.appendChild(popup.render());
return this.container;

View File

@ -0,0 +1 @@
https://bug1627030.bmoattachments.org/attachment.cgi?id=9137808

View File

@ -780,6 +780,16 @@
"annotations": true,
"about": "Annotation with (ridiculously) large border width."
},
{ "id": "bug1627030",
"file": "pdfs/bug1627030.pdf",
"md5": "4cde6134daa80449c43defd02c1393e2",
"rounds": 1,
"link": true,
"firstPage": 3,
"lastPage": 3,
"type": "eq",
"annotations": true
},
{ "id": "issue4934",
"file": "pdfs/issue4934.pdf",
"md5": "6099da44f677702ae65a648b51a2226d",