diff --git a/src/display/annotation_layer.js b/src/display/annotation_layer.js index 6bac96d04..1664ac7d2 100644 --- a/src/display/annotation_layer.js +++ b/src/display/annotation_layer.js @@ -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; diff --git a/test/pdfs/bug1627030.pdf.link b/test/pdfs/bug1627030.pdf.link new file mode 100644 index 000000000..bd5434d0c --- /dev/null +++ b/test/pdfs/bug1627030.pdf.link @@ -0,0 +1 @@ +https://bug1627030.bmoattachments.org/attachment.cgi?id=9137808 diff --git a/test/test_manifest.json b/test/test_manifest.json index 98f776b35..74ee134d8 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -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",