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:
Tim van der Meij 2020-12-05 20:29:21 +01:00
parent 7be4a14d87
commit e3b6a9fb23
No known key found for this signature in database
GPG Key ID: 8C3FD2925A5F2762

View File

@ -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;
}