From e3b6a9fb23ffb0652b25322348bc8908654a9027 Mon Sep 17 00:00:00 2001 From: Tim van der Meij Date: Sat, 5 Dec 2020 20:29:21 +0100 Subject: [PATCH] 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. --- src/display/annotation_layer.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/display/annotation_layer.js b/src/display/annotation_layer.js index fcf7b7506..cb1b42800 100644 --- a/src/display/annotation_layer.js +++ b/src/display/annotation_layer.js @@ -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; }