Skip to content

Commit 54ffe45

Browse files
hakubojolek
authored and
jolek
committed
Make sure that Popup is rendered next to trigger for textAnnotation
1 parent 3e52098 commit 54ffe45

File tree

4 files changed

+13
-2
lines changed

4 files changed

+13
-2
lines changed

src/display/annotation_layer.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -807,11 +807,14 @@ class PopupAnnotationElement extends AnnotationElement {
807807
// PDF viewers ignore a popup annotation's rectangle.
808808
const parentTop = parseFloat(parentElement.style.top),
809809
parentLeft = parseFloat(parentElement.style.left),
810-
parentWidth = parseFloat(parentElement.style.width);
810+
parentWidth = parseFloat(parentElement.style.width),
811+
parentHeight = parseFloat(parentElement.style.height);
811812
const popupLeft = parentLeft + parentWidth;
813+
const popupTop = parentTop + parentHeight;
812814

813815
this.container.style.transformOrigin = `${-popupLeft}px ${-parentTop}px`;
814816
this.container.style.left = `${popupLeft}px`;
817+
this.container.style.top = `${popupTop}px`;
815818

816819
this.container.appendChild(popup.render());
817820
return this.container;

test/pdfs/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -400,3 +400,4 @@
400400
!tiling-pattern-large-steps.pdf
401401
!issue11555.pdf
402402
!issue12337.pdf
403+
!pr12564.pdf

test/pdfs/pr12564.pdf

144 KB
Binary file not shown.

test/test_manifest.json

+8-1
Original file line numberDiff line numberDiff line change
@@ -4784,5 +4784,12 @@
47844784
"rounds": 2,
47854785
"lastPage": 1,
47864786
"type": "fbf"
4787-
}
4787+
},
4788+
{ "id": "pr12564",
4789+
"file": "pdfs/pr12564.pdf",
4790+
"md5": "8033857922eb03d050f6a04c2f5e9851",
4791+
"rounds": 1,
4792+
"type": "eq",
4793+
"annotations": true
4794+
},
47884795
]

0 commit comments

Comments
 (0)