Merge pull request #12621 from calixteman/12614

Follow-up for #12585: set elements class in render instead of in _createQuadrilaterals
This commit is contained in:
Tim van der Meij 2020-11-14 16:44:50 +01:00 committed by GitHub
commit bfc5d0d57c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -259,16 +259,13 @@ class AnnotationElement {
const quadrilaterals = [];
const savedRect = this.data.rect;
for (const quadPoint of this.data.quadPoints) {
const rect = [
this.data.rect = [
quadPoint[2].x,
quadPoint[2].y,
quadPoint[1].x,
quadPoint[1].y,
];
this.data.rect = rect;
const quad = this._createContainer(ignoreBorder);
quad.className = "highlightAnnotation";
quadrilaterals.push(quad);
quadrilaterals.push(this._createContainer(ignoreBorder));
}
this.data.rect = savedRect;
return quadrilaterals;
@ -1390,12 +1387,19 @@ class HighlightAnnotationElement extends AnnotationElement {
* @returns {HTMLSectionElement}
*/
render() {
this.container.className = "highlightAnnotation";
if (!this.data.hasPopup) {
this._createPopup(null, this.data);
}
return this.quadrilaterals || this.container;
if (this.quadrilaterals) {
this.quadrilaterals.forEach(quadrilateral => {
quadrilateral.className = "highlightAnnotation";
});
return this.quadrilaterals;
}
this.container.className = "highlightAnnotation";
return this.container;
}
}