mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
Implement quadpoints rendering for link annotations
Each quadrilateral needs to have its own link element, so the first quadrilateral can use the already created element, but the next quadrilaterals need to clone that element.
This commit is contained in:
parent
7be4a14d87
commit
e3b6a9fb23
1 changed files with 12 additions and 3 deletions
|
@ -367,12 +367,10 @@ class LinkAnnotationElement extends AnnotationElement {
|
|||
parameters.data.action ||
|
||||
parameters.data.isTooltipOnly
|
||||
);
|
||||
super(parameters, { isRenderable });
|
||||
super(parameters, { isRenderable, createQuadrilaterals: true });
|
||||
}
|
||||
|
||||
render() {
|
||||
this.container.className = "linkAnnotation";
|
||||
|
||||
const { data, linkService } = this;
|
||||
const link = document.createElement("a");
|
||||
|
||||
|
@ -393,6 +391,17 @@ class LinkAnnotationElement extends AnnotationElement {
|
|||
this._bindLink(link, "");
|
||||
}
|
||||
|
||||
if (this.quadrilaterals) {
|
||||
return this._renderQuadrilaterals("linkAnnotation").map(
|
||||
(quadrilateral, index) => {
|
||||
const linkElement = index === 0 ? link : link.cloneNode();
|
||||
quadrilateral.appendChild(linkElement);
|
||||
return quadrilateral;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
this.container.className = "linkAnnotation";
|
||||
this.container.appendChild(link);
|
||||
return this.container;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue