mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-10 02:05:37 +02:00
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes). Prettier is being used for a couple of reasons: - To be consistent with `mozilla-central`, where Prettier is already in use across the tree. - To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters. Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some). Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long. *Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit. (On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
This commit is contained in:
parent
8ec1dfde49
commit
de36b2aaba
205 changed files with 40024 additions and 31859 deletions
|
@ -15,13 +15,20 @@
|
|||
/* eslint no-var: error */
|
||||
|
||||
import {
|
||||
addLinkAttributes, DOMSVGFactory, getFilenameFromUrl, LinkTarget,
|
||||
PDFDateString
|
||||
} from './display_utils';
|
||||
addLinkAttributes,
|
||||
DOMSVGFactory,
|
||||
getFilenameFromUrl,
|
||||
LinkTarget,
|
||||
PDFDateString,
|
||||
} from "./display_utils";
|
||||
import {
|
||||
AnnotationBorderStyleType, AnnotationType, stringToPDFString, unreachable,
|
||||
Util, warn
|
||||
} from '../shared/util';
|
||||
AnnotationBorderStyleType,
|
||||
AnnotationType,
|
||||
stringToPDFString,
|
||||
unreachable,
|
||||
Util,
|
||||
warn,
|
||||
} from "../shared/util";
|
||||
|
||||
/**
|
||||
* @typedef {Object} AnnotationElementParameters
|
||||
|
@ -56,16 +63,16 @@ class AnnotationElementFactory {
|
|||
const fieldType = parameters.data.fieldType;
|
||||
|
||||
switch (fieldType) {
|
||||
case 'Tx':
|
||||
case "Tx":
|
||||
return new TextWidgetAnnotationElement(parameters);
|
||||
case 'Btn':
|
||||
case "Btn":
|
||||
if (parameters.data.radioButton) {
|
||||
return new RadioButtonWidgetAnnotationElement(parameters);
|
||||
} else if (parameters.data.checkBox) {
|
||||
return new CheckboxWidgetAnnotationElement(parameters);
|
||||
}
|
||||
return new PushButtonWidgetAnnotationElement(parameters);
|
||||
case 'Ch':
|
||||
case "Ch":
|
||||
return new ChoiceWidgetAnnotationElement(parameters);
|
||||
}
|
||||
return new WidgetAnnotationElement(parameters);
|
||||
|
@ -148,12 +155,14 @@ class AnnotationElement {
|
|||
* @returns {HTMLSectionElement}
|
||||
*/
|
||||
_createContainer(ignoreBorder = false) {
|
||||
const data = this.data, page = this.page, viewport = this.viewport;
|
||||
const container = document.createElement('section');
|
||||
const data = this.data,
|
||||
page = this.page,
|
||||
viewport = this.viewport;
|
||||
const container = document.createElement("section");
|
||||
let width = data.rect[2] - data.rect[0];
|
||||
let height = data.rect[3] - data.rect[1];
|
||||
|
||||
container.setAttribute('data-annotation-id', data.id);
|
||||
container.setAttribute("data-annotation-id", data.id);
|
||||
|
||||
// Do *not* modify `data.rect`, since that will corrupt the annotation
|
||||
// position on subsequent calls to `_createContainer` (see issue 6804).
|
||||
|
@ -161,10 +170,10 @@ class AnnotationElement {
|
|||
data.rect[0],
|
||||
page.view[3] - data.rect[1] + page.view[1],
|
||||
data.rect[2],
|
||||
page.view[3] - data.rect[3] + page.view[1]
|
||||
page.view[3] - data.rect[3] + page.view[1],
|
||||
]);
|
||||
|
||||
container.style.transform = `matrix(${viewport.transform.join(',')})`;
|
||||
container.style.transform = `matrix(${viewport.transform.join(",")})`;
|
||||
container.style.transformOrigin = `-${rect[0]}px -${rect[1]}px`;
|
||||
|
||||
if (!ignoreBorder && data.borderStyle.width > 0) {
|
||||
|
@ -186,23 +195,23 @@ class AnnotationElement {
|
|||
|
||||
switch (data.borderStyle.style) {
|
||||
case AnnotationBorderStyleType.SOLID:
|
||||
container.style.borderStyle = 'solid';
|
||||
container.style.borderStyle = "solid";
|
||||
break;
|
||||
|
||||
case AnnotationBorderStyleType.DASHED:
|
||||
container.style.borderStyle = 'dashed';
|
||||
container.style.borderStyle = "dashed";
|
||||
break;
|
||||
|
||||
case AnnotationBorderStyleType.BEVELED:
|
||||
warn('Unimplemented border style: beveled');
|
||||
warn("Unimplemented border style: beveled");
|
||||
break;
|
||||
|
||||
case AnnotationBorderStyleType.INSET:
|
||||
warn('Unimplemented border style: inset');
|
||||
warn("Unimplemented border style: inset");
|
||||
break;
|
||||
|
||||
case AnnotationBorderStyleType.UNDERLINE:
|
||||
container.style.borderBottomStyle = 'solid';
|
||||
container.style.borderBottomStyle = "solid";
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -210,9 +219,11 @@ class AnnotationElement {
|
|||
}
|
||||
|
||||
if (data.color) {
|
||||
container.style.borderColor = Util.makeCssRgb(data.color[0] | 0,
|
||||
data.color[1] | 0,
|
||||
data.color[2] | 0);
|
||||
container.style.borderColor = Util.makeCssRgb(
|
||||
data.color[0] | 0,
|
||||
data.color[1] | 0,
|
||||
data.color[2] | 0
|
||||
);
|
||||
} else {
|
||||
// Transparent (invisible) border, so do not draw it at all.
|
||||
container.style.borderWidth = 0;
|
||||
|
@ -240,7 +251,7 @@ class AnnotationElement {
|
|||
_createPopup(container, trigger, data) {
|
||||
// If no trigger element is specified, create it.
|
||||
if (!trigger) {
|
||||
trigger = document.createElement('div');
|
||||
trigger = document.createElement("div");
|
||||
trigger.style.height = container.style.height;
|
||||
trigger.style.width = container.style.width;
|
||||
container.appendChild(trigger);
|
||||
|
@ -270,14 +281,17 @@ class AnnotationElement {
|
|||
* @memberof AnnotationElement
|
||||
*/
|
||||
render() {
|
||||
unreachable('Abstract method `AnnotationElement.render` called');
|
||||
unreachable("Abstract method `AnnotationElement.render` called");
|
||||
}
|
||||
}
|
||||
|
||||
class LinkAnnotationElement extends AnnotationElement {
|
||||
constructor(parameters) {
|
||||
const isRenderable = !!(parameters.data.url || parameters.data.dest ||
|
||||
parameters.data.action);
|
||||
const isRenderable = !!(
|
||||
parameters.data.url ||
|
||||
parameters.data.dest ||
|
||||
parameters.data.action
|
||||
);
|
||||
super(parameters, isRenderable);
|
||||
}
|
||||
|
||||
|
@ -289,16 +303,17 @@ class LinkAnnotationElement extends AnnotationElement {
|
|||
* @returns {HTMLSectionElement}
|
||||
*/
|
||||
render() {
|
||||
this.container.className = 'linkAnnotation';
|
||||
this.container.className = "linkAnnotation";
|
||||
|
||||
const { data, linkService, } = this;
|
||||
const link = document.createElement('a');
|
||||
const { data, linkService } = this;
|
||||
const link = document.createElement("a");
|
||||
|
||||
if (data.url) {
|
||||
addLinkAttributes(link, {
|
||||
url: data.url,
|
||||
target: (data.newWindow ?
|
||||
LinkTarget.BLANK : linkService.externalLinkTarget),
|
||||
target: data.newWindow
|
||||
? LinkTarget.BLANK
|
||||
: linkService.externalLinkTarget,
|
||||
rel: linkService.externalLinkRel,
|
||||
enabled: linkService.externalLinkEnabled,
|
||||
});
|
||||
|
@ -329,7 +344,7 @@ class LinkAnnotationElement extends AnnotationElement {
|
|||
return false;
|
||||
};
|
||||
if (destination) {
|
||||
link.className = 'internalLink';
|
||||
link.className = "internalLink";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -342,19 +357,22 @@ class LinkAnnotationElement extends AnnotationElement {
|
|||
* @memberof LinkAnnotationElement
|
||||
*/
|
||||
_bindNamedAction(link, action) {
|
||||
link.href = this.linkService.getAnchorUrl('');
|
||||
link.href = this.linkService.getAnchorUrl("");
|
||||
link.onclick = () => {
|
||||
this.linkService.executeNamedAction(action);
|
||||
return false;
|
||||
};
|
||||
link.className = 'internalLink';
|
||||
link.className = "internalLink";
|
||||
}
|
||||
}
|
||||
|
||||
class TextAnnotationElement extends AnnotationElement {
|
||||
constructor(parameters) {
|
||||
const isRenderable = !!(parameters.data.hasPopup ||
|
||||
parameters.data.title || parameters.data.contents);
|
||||
const isRenderable = !!(
|
||||
parameters.data.hasPopup ||
|
||||
parameters.data.title ||
|
||||
parameters.data.contents
|
||||
);
|
||||
super(parameters, isRenderable);
|
||||
}
|
||||
|
||||
|
@ -366,16 +384,19 @@ class TextAnnotationElement extends AnnotationElement {
|
|||
* @returns {HTMLSectionElement}
|
||||
*/
|
||||
render() {
|
||||
this.container.className = 'textAnnotation';
|
||||
this.container.className = "textAnnotation";
|
||||
|
||||
const image = document.createElement('img');
|
||||
const image = document.createElement("img");
|
||||
image.style.height = this.container.style.height;
|
||||
image.style.width = this.container.style.width;
|
||||
image.src = this.imageResourcesPath + 'annotation-' +
|
||||
this.data.name.toLowerCase() + '.svg';
|
||||
image.alt = '[{{type}} Annotation]';
|
||||
image.dataset.l10nId = 'text_annotation_type';
|
||||
image.dataset.l10nArgs = JSON.stringify({ type: this.data.name, });
|
||||
image.src =
|
||||
this.imageResourcesPath +
|
||||
"annotation-" +
|
||||
this.data.name.toLowerCase() +
|
||||
".svg";
|
||||
image.alt = "[{{type}} Annotation]";
|
||||
image.dataset.l10nId = "text_annotation_type";
|
||||
image.dataset.l10nArgs = JSON.stringify({ type: this.data.name });
|
||||
|
||||
if (!this.data.hasPopup) {
|
||||
this._createPopup(this.container, image, this.data);
|
||||
|
@ -402,7 +423,8 @@ class WidgetAnnotationElement extends AnnotationElement {
|
|||
|
||||
class TextWidgetAnnotationElement extends WidgetAnnotationElement {
|
||||
constructor(parameters) {
|
||||
const isRenderable = parameters.renderInteractiveForms ||
|
||||
const isRenderable =
|
||||
parameters.renderInteractiveForms ||
|
||||
(!parameters.data.hasAppearance && !!parameters.data.fieldValue);
|
||||
super(parameters, isRenderable);
|
||||
}
|
||||
|
@ -415,9 +437,9 @@ class TextWidgetAnnotationElement extends WidgetAnnotationElement {
|
|||
* @returns {HTMLSectionElement}
|
||||
*/
|
||||
render() {
|
||||
const TEXT_ALIGNMENT = ['left', 'center', 'right'];
|
||||
const TEXT_ALIGNMENT = ["left", "center", "right"];
|
||||
|
||||
this.container.className = 'textWidgetAnnotation';
|
||||
this.container.className = "textWidgetAnnotation";
|
||||
|
||||
let element = null;
|
||||
if (this.renderInteractiveForms) {
|
||||
|
@ -425,12 +447,12 @@ class TextWidgetAnnotationElement extends WidgetAnnotationElement {
|
|||
// prevents the AnnotationLayer rasterizer in `test/driver.js`
|
||||
// from parsing the elements correctly for the reference tests.
|
||||
if (this.data.multiLine) {
|
||||
element = document.createElement('textarea');
|
||||
element = document.createElement("textarea");
|
||||
element.textContent = this.data.fieldValue;
|
||||
} else {
|
||||
element = document.createElement('input');
|
||||
element.type = 'text';
|
||||
element.setAttribute('value', this.data.fieldValue);
|
||||
element = document.createElement("input");
|
||||
element.type = "text";
|
||||
element.setAttribute("value", this.data.fieldValue);
|
||||
}
|
||||
|
||||
element.disabled = this.data.readOnly;
|
||||
|
@ -443,18 +465,20 @@ class TextWidgetAnnotationElement extends WidgetAnnotationElement {
|
|||
const fieldWidth = this.data.rect[2] - this.data.rect[0];
|
||||
const combWidth = fieldWidth / this.data.maxLen;
|
||||
|
||||
element.classList.add('comb');
|
||||
element.classList.add("comb");
|
||||
element.style.letterSpacing = `calc(${combWidth}px - 1ch)`;
|
||||
}
|
||||
} else {
|
||||
element = document.createElement('div');
|
||||
element = document.createElement("div");
|
||||
element.textContent = this.data.fieldValue;
|
||||
element.style.verticalAlign = 'middle';
|
||||
element.style.display = 'table-cell';
|
||||
element.style.verticalAlign = "middle";
|
||||
element.style.display = "table-cell";
|
||||
|
||||
let font = null;
|
||||
if (this.data.fontRefName &&
|
||||
this.page.commonObjs.has(this.data.fontRefName)) {
|
||||
if (
|
||||
this.data.fontRefName &&
|
||||
this.page.commonObjs.has(this.data.fontRefName)
|
||||
) {
|
||||
font = this.page.commonObjs.get(this.data.fontRefName);
|
||||
}
|
||||
this._setTextStyle(element, font);
|
||||
|
@ -480,20 +504,24 @@ class TextWidgetAnnotationElement extends WidgetAnnotationElement {
|
|||
// TODO: This duplicates some of the logic in CanvasGraphics.setFont().
|
||||
const style = element.style;
|
||||
style.fontSize = `${this.data.fontSize}px`;
|
||||
style.direction = (this.data.fontDirection < 0 ? 'rtl' : 'ltr');
|
||||
style.direction = this.data.fontDirection < 0 ? "rtl" : "ltr";
|
||||
|
||||
if (!font) {
|
||||
return;
|
||||
}
|
||||
|
||||
style.fontWeight = (font.black ?
|
||||
(font.bold ? '900' : 'bold') :
|
||||
(font.bold ? 'bold' : 'normal'));
|
||||
style.fontStyle = (font.italic ? 'italic' : 'normal');
|
||||
style.fontWeight = font.black
|
||||
? font.bold
|
||||
? "900"
|
||||
: "bold"
|
||||
: font.bold
|
||||
? "bold"
|
||||
: "normal";
|
||||
style.fontStyle = font.italic ? "italic" : "normal";
|
||||
|
||||
// Use a reasonable default font if the font doesn't specify a fallback.
|
||||
const fontFamily = font.loadedName ? `"${font.loadedName}", ` : '';
|
||||
const fallbackName = font.fallbackName || 'Helvetica, sans-serif';
|
||||
const fontFamily = font.loadedName ? `"${font.loadedName}", ` : "";
|
||||
const fallbackName = font.fallbackName || "Helvetica, sans-serif";
|
||||
style.fontFamily = fontFamily + fallbackName;
|
||||
}
|
||||
}
|
||||
|
@ -512,13 +540,13 @@ class CheckboxWidgetAnnotationElement extends WidgetAnnotationElement {
|
|||
* @returns {HTMLSectionElement}
|
||||
*/
|
||||
render() {
|
||||
this.container.className = 'buttonWidgetAnnotation checkBox';
|
||||
this.container.className = "buttonWidgetAnnotation checkBox";
|
||||
|
||||
const element = document.createElement('input');
|
||||
const element = document.createElement("input");
|
||||
element.disabled = this.data.readOnly;
|
||||
element.type = 'checkbox';
|
||||
if (this.data.fieldValue && this.data.fieldValue !== 'Off') {
|
||||
element.setAttribute('checked', true);
|
||||
element.type = "checkbox";
|
||||
if (this.data.fieldValue && this.data.fieldValue !== "Off") {
|
||||
element.setAttribute("checked", true);
|
||||
}
|
||||
|
||||
this.container.appendChild(element);
|
||||
|
@ -540,14 +568,14 @@ class RadioButtonWidgetAnnotationElement extends WidgetAnnotationElement {
|
|||
* @returns {HTMLSectionElement}
|
||||
*/
|
||||
render() {
|
||||
this.container.className = 'buttonWidgetAnnotation radioButton';
|
||||
this.container.className = "buttonWidgetAnnotation radioButton";
|
||||
|
||||
const element = document.createElement('input');
|
||||
const element = document.createElement("input");
|
||||
element.disabled = this.data.readOnly;
|
||||
element.type = 'radio';
|
||||
element.type = "radio";
|
||||
element.name = this.data.fieldName;
|
||||
if (this.data.fieldValue === this.data.buttonValue) {
|
||||
element.setAttribute('checked', true);
|
||||
element.setAttribute("checked", true);
|
||||
}
|
||||
|
||||
this.container.appendChild(element);
|
||||
|
@ -569,7 +597,7 @@ class PushButtonWidgetAnnotationElement extends LinkAnnotationElement {
|
|||
// equal to that of a link annotation, but may have more functionality, such
|
||||
// as performing actions on form fields (resetting, submitting, et cetera).
|
||||
const container = super.render();
|
||||
container.className = 'buttonWidgetAnnotation pushButton';
|
||||
container.className = "buttonWidgetAnnotation pushButton";
|
||||
return container;
|
||||
}
|
||||
}
|
||||
|
@ -588,9 +616,9 @@ class ChoiceWidgetAnnotationElement extends WidgetAnnotationElement {
|
|||
* @returns {HTMLSectionElement}
|
||||
*/
|
||||
render() {
|
||||
this.container.className = 'choiceWidgetAnnotation';
|
||||
this.container.className = "choiceWidgetAnnotation";
|
||||
|
||||
const selectElement = document.createElement('select');
|
||||
const selectElement = document.createElement("select");
|
||||
selectElement.disabled = this.data.readOnly;
|
||||
|
||||
if (!this.data.combo) {
|
||||
|
@ -603,11 +631,11 @@ class ChoiceWidgetAnnotationElement extends WidgetAnnotationElement {
|
|||
|
||||
// Insert the options into the choice field.
|
||||
for (const option of this.data.options) {
|
||||
const optionElement = document.createElement('option');
|
||||
const optionElement = document.createElement("option");
|
||||
optionElement.textContent = option.displayValue;
|
||||
optionElement.value = option.exportValue;
|
||||
if (this.data.fieldValue.includes(option.displayValue)) {
|
||||
optionElement.setAttribute('selected', true);
|
||||
optionElement.setAttribute("selected", true);
|
||||
}
|
||||
selectElement.appendChild(optionElement);
|
||||
}
|
||||
|
@ -634,15 +662,15 @@ class PopupAnnotationElement extends AnnotationElement {
|
|||
// Do not render popup annotations for parent elements with these types as
|
||||
// they create the popups themselves (because of custom trigger divs).
|
||||
const IGNORE_TYPES = [
|
||||
'Line',
|
||||
'Square',
|
||||
'Circle',
|
||||
'PolyLine',
|
||||
'Polygon',
|
||||
'Ink',
|
||||
"Line",
|
||||
"Square",
|
||||
"Circle",
|
||||
"PolyLine",
|
||||
"Polygon",
|
||||
"Ink",
|
||||
];
|
||||
|
||||
this.container.className = 'popupAnnotation';
|
||||
this.container.className = "popupAnnotation";
|
||||
|
||||
if (IGNORE_TYPES.includes(this.data.parentType)) {
|
||||
return this.container;
|
||||
|
@ -667,8 +695,9 @@ class PopupAnnotationElement extends AnnotationElement {
|
|||
// PDF viewers ignore a popup annotation's rectangle.
|
||||
const parentLeft = parseFloat(parentElement.style.left);
|
||||
const parentWidth = parseFloat(parentElement.style.width);
|
||||
this.container.style.transformOrigin =
|
||||
`-${parentLeft + parentWidth}px -${parentElement.style.top}`;
|
||||
this.container.style.transformOrigin = `-${parentLeft + parentWidth}px -${
|
||||
parentElement.style.top
|
||||
}`;
|
||||
this.container.style.left = `${parentLeft + parentWidth}px`;
|
||||
|
||||
this.container.appendChild(popup.render());
|
||||
|
@ -699,18 +728,18 @@ class PopupElement {
|
|||
render() {
|
||||
const BACKGROUND_ENLIGHT = 0.7;
|
||||
|
||||
const wrapper = document.createElement('div');
|
||||
wrapper.className = 'popupWrapper';
|
||||
const wrapper = document.createElement("div");
|
||||
wrapper.className = "popupWrapper";
|
||||
|
||||
// For Popup annotations we hide the entire section because it contains
|
||||
// only the popup. However, for Text annotations without a separate Popup
|
||||
// annotation, we cannot hide the entire container as the image would
|
||||
// disappear too. In that special case, hiding the wrapper suffices.
|
||||
this.hideElement = (this.hideWrapper ? wrapper : this.container);
|
||||
this.hideElement.setAttribute('hidden', true);
|
||||
this.hideElement = this.hideWrapper ? wrapper : this.container;
|
||||
this.hideElement.setAttribute("hidden", true);
|
||||
|
||||
const popup = document.createElement('div');
|
||||
popup.className = 'popup';
|
||||
const popup = document.createElement("div");
|
||||
popup.className = "popup";
|
||||
|
||||
const color = this.color;
|
||||
if (color) {
|
||||
|
@ -721,7 +750,7 @@ class PopupElement {
|
|||
popup.style.backgroundColor = Util.makeCssRgb(r | 0, g | 0, b | 0);
|
||||
}
|
||||
|
||||
const title = document.createElement('h1');
|
||||
const title = document.createElement("h1");
|
||||
title.textContent = this.title;
|
||||
popup.appendChild(title);
|
||||
|
||||
|
@ -730,9 +759,9 @@ class PopupElement {
|
|||
// consistent with other viewers such as Adobe Acrobat.
|
||||
const dateObject = PDFDateString.toDateObject(this.modificationDate);
|
||||
if (dateObject) {
|
||||
const modificationDate = document.createElement('span');
|
||||
modificationDate.textContent = '{{date}}, {{time}}';
|
||||
modificationDate.dataset.l10nId = 'annotation_date_string';
|
||||
const modificationDate = document.createElement("span");
|
||||
modificationDate.textContent = "{{date}}, {{time}}";
|
||||
modificationDate.dataset.l10nId = "annotation_date_string";
|
||||
modificationDate.dataset.l10nArgs = JSON.stringify({
|
||||
date: dateObject.toLocaleDateString(),
|
||||
time: dateObject.toLocaleTimeString(),
|
||||
|
@ -744,10 +773,10 @@ class PopupElement {
|
|||
popup.appendChild(contents);
|
||||
|
||||
// Attach the event listeners to the trigger element.
|
||||
this.trigger.addEventListener('click', this._toggle.bind(this));
|
||||
this.trigger.addEventListener('mouseover', this._show.bind(this, false));
|
||||
this.trigger.addEventListener('mouseout', this._hide.bind(this, false));
|
||||
popup.addEventListener('click', this._hide.bind(this, true));
|
||||
this.trigger.addEventListener("click", this._toggle.bind(this));
|
||||
this.trigger.addEventListener("mouseover", this._show.bind(this, false));
|
||||
this.trigger.addEventListener("mouseout", this._hide.bind(this, false));
|
||||
popup.addEventListener("click", this._hide.bind(this, true));
|
||||
|
||||
wrapper.appendChild(popup);
|
||||
return wrapper;
|
||||
|
@ -762,13 +791,13 @@ class PopupElement {
|
|||
* @returns {HTMLParagraphElement}
|
||||
*/
|
||||
_formatContents(contents) {
|
||||
const p = document.createElement('p');
|
||||
const p = document.createElement("p");
|
||||
const lines = contents.split(/(?:\r\n?|\n)/);
|
||||
for (let i = 0, ii = lines.length; i < ii; ++i) {
|
||||
const line = lines[i];
|
||||
p.appendChild(document.createTextNode(line));
|
||||
if (i < (ii - 1)) {
|
||||
p.appendChild(document.createElement('br'));
|
||||
if (i < ii - 1) {
|
||||
p.appendChild(document.createElement("br"));
|
||||
}
|
||||
}
|
||||
return p;
|
||||
|
@ -799,8 +828,8 @@ class PopupElement {
|
|||
if (pin) {
|
||||
this.pinned = true;
|
||||
}
|
||||
if (this.hideElement.hasAttribute('hidden')) {
|
||||
this.hideElement.removeAttribute('hidden');
|
||||
if (this.hideElement.hasAttribute("hidden")) {
|
||||
this.hideElement.removeAttribute("hidden");
|
||||
this.container.style.zIndex += 1;
|
||||
}
|
||||
}
|
||||
|
@ -816,8 +845,8 @@ class PopupElement {
|
|||
if (unpin) {
|
||||
this.pinned = false;
|
||||
}
|
||||
if (!this.hideElement.hasAttribute('hidden') && !this.pinned) {
|
||||
this.hideElement.setAttribute('hidden', true);
|
||||
if (!this.hideElement.hasAttribute("hidden") && !this.pinned) {
|
||||
this.hideElement.setAttribute("hidden", true);
|
||||
this.container.style.zIndex -= 1;
|
||||
}
|
||||
}
|
||||
|
@ -825,8 +854,11 @@ class PopupElement {
|
|||
|
||||
class FreeTextAnnotationElement extends AnnotationElement {
|
||||
constructor(parameters) {
|
||||
const isRenderable = !!(parameters.data.hasPopup ||
|
||||
parameters.data.title || parameters.data.contents);
|
||||
const isRenderable = !!(
|
||||
parameters.data.hasPopup ||
|
||||
parameters.data.title ||
|
||||
parameters.data.contents
|
||||
);
|
||||
super(parameters, isRenderable, /* ignoreBorder = */ true);
|
||||
}
|
||||
|
||||
|
@ -838,7 +870,7 @@ class FreeTextAnnotationElement extends AnnotationElement {
|
|||
* @returns {HTMLSectionElement}
|
||||
*/
|
||||
render() {
|
||||
this.container.className = 'freeTextAnnotation';
|
||||
this.container.className = "freeTextAnnotation";
|
||||
|
||||
if (!this.data.hasPopup) {
|
||||
this._createPopup(this.container, null, this.data);
|
||||
|
@ -849,8 +881,11 @@ class FreeTextAnnotationElement extends AnnotationElement {
|
|||
|
||||
class LineAnnotationElement extends AnnotationElement {
|
||||
constructor(parameters) {
|
||||
const isRenderable = !!(parameters.data.hasPopup ||
|
||||
parameters.data.title || parameters.data.contents);
|
||||
const isRenderable = !!(
|
||||
parameters.data.hasPopup ||
|
||||
parameters.data.title ||
|
||||
parameters.data.contents
|
||||
);
|
||||
super(parameters, isRenderable, /* ignoreBorder = */ true);
|
||||
}
|
||||
|
||||
|
@ -862,7 +897,7 @@ class LineAnnotationElement extends AnnotationElement {
|
|||
* @returns {HTMLSectionElement}
|
||||
*/
|
||||
render() {
|
||||
this.container.className = 'lineAnnotation';
|
||||
this.container.className = "lineAnnotation";
|
||||
|
||||
// Create an invisible line with the same starting and ending coordinates
|
||||
// that acts as the trigger for the popup. Only the line itself should
|
||||
|
@ -874,15 +909,15 @@ class LineAnnotationElement extends AnnotationElement {
|
|||
|
||||
// PDF coordinates are calculated from a bottom left origin, so transform
|
||||
// the line coordinates to a top left origin for the SVG element.
|
||||
const line = this.svgFactory.createElement('svg:line');
|
||||
line.setAttribute('x1', data.rect[2] - data.lineCoordinates[0]);
|
||||
line.setAttribute('y1', data.rect[3] - data.lineCoordinates[1]);
|
||||
line.setAttribute('x2', data.rect[2] - data.lineCoordinates[2]);
|
||||
line.setAttribute('y2', data.rect[3] - data.lineCoordinates[3]);
|
||||
const line = this.svgFactory.createElement("svg:line");
|
||||
line.setAttribute("x1", data.rect[2] - data.lineCoordinates[0]);
|
||||
line.setAttribute("y1", data.rect[3] - data.lineCoordinates[1]);
|
||||
line.setAttribute("x2", data.rect[2] - data.lineCoordinates[2]);
|
||||
line.setAttribute("y2", data.rect[3] - data.lineCoordinates[3]);
|
||||
// Ensure that the 'stroke-width' is always non-zero, since otherwise it
|
||||
// won't be possible to open/close the popup (note e.g. issue 11122).
|
||||
line.setAttribute('stroke-width', data.borderStyle.width || 1);
|
||||
line.setAttribute('stroke', 'transparent');
|
||||
line.setAttribute("stroke-width", data.borderStyle.width || 1);
|
||||
line.setAttribute("stroke", "transparent");
|
||||
|
||||
svg.appendChild(line);
|
||||
this.container.append(svg);
|
||||
|
@ -897,8 +932,11 @@ class LineAnnotationElement extends AnnotationElement {
|
|||
|
||||
class SquareAnnotationElement extends AnnotationElement {
|
||||
constructor(parameters) {
|
||||
const isRenderable = !!(parameters.data.hasPopup ||
|
||||
parameters.data.title || parameters.data.contents);
|
||||
const isRenderable = !!(
|
||||
parameters.data.hasPopup ||
|
||||
parameters.data.title ||
|
||||
parameters.data.contents
|
||||
);
|
||||
super(parameters, isRenderable, /* ignoreBorder = */ true);
|
||||
}
|
||||
|
||||
|
@ -910,7 +948,7 @@ class SquareAnnotationElement extends AnnotationElement {
|
|||
* @returns {HTMLSectionElement}
|
||||
*/
|
||||
render() {
|
||||
this.container.className = 'squareAnnotation';
|
||||
this.container.className = "squareAnnotation";
|
||||
|
||||
// Create an invisible square with the same rectangle that acts as the
|
||||
// trigger for the popup. Only the square itself should trigger the
|
||||
|
@ -924,16 +962,16 @@ class SquareAnnotationElement extends AnnotationElement {
|
|||
// the borders outside the square by default. This behavior cannot be
|
||||
// changed programmatically, so correct for that here.
|
||||
const borderWidth = data.borderStyle.width;
|
||||
const square = this.svgFactory.createElement('svg:rect');
|
||||
square.setAttribute('x', borderWidth / 2);
|
||||
square.setAttribute('y', borderWidth / 2);
|
||||
square.setAttribute('width', width - borderWidth);
|
||||
square.setAttribute('height', height - borderWidth);
|
||||
const square = this.svgFactory.createElement("svg:rect");
|
||||
square.setAttribute("x", borderWidth / 2);
|
||||
square.setAttribute("y", borderWidth / 2);
|
||||
square.setAttribute("width", width - borderWidth);
|
||||
square.setAttribute("height", height - borderWidth);
|
||||
// Ensure that the 'stroke-width' is always non-zero, since otherwise it
|
||||
// won't be possible to open/close the popup (note e.g. issue 11122).
|
||||
square.setAttribute('stroke-width', borderWidth || 1);
|
||||
square.setAttribute('stroke', 'transparent');
|
||||
square.setAttribute('fill', 'none');
|
||||
square.setAttribute("stroke-width", borderWidth || 1);
|
||||
square.setAttribute("stroke", "transparent");
|
||||
square.setAttribute("fill", "none");
|
||||
|
||||
svg.appendChild(square);
|
||||
this.container.append(svg);
|
||||
|
@ -948,8 +986,11 @@ class SquareAnnotationElement extends AnnotationElement {
|
|||
|
||||
class CircleAnnotationElement extends AnnotationElement {
|
||||
constructor(parameters) {
|
||||
const isRenderable = !!(parameters.data.hasPopup ||
|
||||
parameters.data.title || parameters.data.contents);
|
||||
const isRenderable = !!(
|
||||
parameters.data.hasPopup ||
|
||||
parameters.data.title ||
|
||||
parameters.data.contents
|
||||
);
|
||||
super(parameters, isRenderable, /* ignoreBorder = */ true);
|
||||
}
|
||||
|
||||
|
@ -961,7 +1002,7 @@ class CircleAnnotationElement extends AnnotationElement {
|
|||
* @returns {HTMLSectionElement}
|
||||
*/
|
||||
render() {
|
||||
this.container.className = 'circleAnnotation';
|
||||
this.container.className = "circleAnnotation";
|
||||
|
||||
// Create an invisible circle with the same ellipse that acts as the
|
||||
// trigger for the popup. Only the circle itself should trigger the
|
||||
|
@ -975,16 +1016,16 @@ class CircleAnnotationElement extends AnnotationElement {
|
|||
// the borders outside the circle by default. This behavior cannot be
|
||||
// changed programmatically, so correct for that here.
|
||||
const borderWidth = data.borderStyle.width;
|
||||
const circle = this.svgFactory.createElement('svg:ellipse');
|
||||
circle.setAttribute('cx', width / 2);
|
||||
circle.setAttribute('cy', height / 2);
|
||||
circle.setAttribute('rx', (width / 2) - (borderWidth / 2));
|
||||
circle.setAttribute('ry', (height / 2) - (borderWidth / 2));
|
||||
const circle = this.svgFactory.createElement("svg:ellipse");
|
||||
circle.setAttribute("cx", width / 2);
|
||||
circle.setAttribute("cy", height / 2);
|
||||
circle.setAttribute("rx", width / 2 - borderWidth / 2);
|
||||
circle.setAttribute("ry", height / 2 - borderWidth / 2);
|
||||
// Ensure that the 'stroke-width' is always non-zero, since otherwise it
|
||||
// won't be possible to open/close the popup (note e.g. issue 11122).
|
||||
circle.setAttribute('stroke-width', borderWidth || 1);
|
||||
circle.setAttribute('stroke', 'transparent');
|
||||
circle.setAttribute('fill', 'none');
|
||||
circle.setAttribute("stroke-width", borderWidth || 1);
|
||||
circle.setAttribute("stroke", "transparent");
|
||||
circle.setAttribute("fill", "none");
|
||||
|
||||
svg.appendChild(circle);
|
||||
this.container.append(svg);
|
||||
|
@ -999,12 +1040,15 @@ class CircleAnnotationElement extends AnnotationElement {
|
|||
|
||||
class PolylineAnnotationElement extends AnnotationElement {
|
||||
constructor(parameters) {
|
||||
const isRenderable = !!(parameters.data.hasPopup ||
|
||||
parameters.data.title || parameters.data.contents);
|
||||
const isRenderable = !!(
|
||||
parameters.data.hasPopup ||
|
||||
parameters.data.title ||
|
||||
parameters.data.contents
|
||||
);
|
||||
super(parameters, isRenderable, /* ignoreBorder = */ true);
|
||||
|
||||
this.containerClassName = 'polylineAnnotation';
|
||||
this.svgElementName = 'svg:polyline';
|
||||
this.containerClassName = "polylineAnnotation";
|
||||
this.svgElementName = "svg:polyline";
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1033,17 +1077,17 @@ class PolylineAnnotationElement extends AnnotationElement {
|
|||
for (const coordinate of data.vertices) {
|
||||
const x = coordinate.x - data.rect[0];
|
||||
const y = data.rect[3] - coordinate.y;
|
||||
points.push(x + ',' + y);
|
||||
points.push(x + "," + y);
|
||||
}
|
||||
points = points.join(' ');
|
||||
points = points.join(" ");
|
||||
|
||||
const polyline = this.svgFactory.createElement(this.svgElementName);
|
||||
polyline.setAttribute('points', points);
|
||||
polyline.setAttribute("points", points);
|
||||
// Ensure that the 'stroke-width' is always non-zero, since otherwise it
|
||||
// won't be possible to open/close the popup (note e.g. issue 11122).
|
||||
polyline.setAttribute('stroke-width', data.borderStyle.width || 1);
|
||||
polyline.setAttribute('stroke', 'transparent');
|
||||
polyline.setAttribute('fill', 'none');
|
||||
polyline.setAttribute("stroke-width", data.borderStyle.width || 1);
|
||||
polyline.setAttribute("stroke", "transparent");
|
||||
polyline.setAttribute("fill", "none");
|
||||
|
||||
svg.appendChild(polyline);
|
||||
this.container.append(svg);
|
||||
|
@ -1061,15 +1105,18 @@ class PolygonAnnotationElement extends PolylineAnnotationElement {
|
|||
// Polygons are specific forms of polylines, so reuse their logic.
|
||||
super(parameters);
|
||||
|
||||
this.containerClassName = 'polygonAnnotation';
|
||||
this.svgElementName = 'svg:polygon';
|
||||
this.containerClassName = "polygonAnnotation";
|
||||
this.svgElementName = "svg:polygon";
|
||||
}
|
||||
}
|
||||
|
||||
class CaretAnnotationElement extends AnnotationElement {
|
||||
constructor(parameters) {
|
||||
const isRenderable = !!(parameters.data.hasPopup ||
|
||||
parameters.data.title || parameters.data.contents);
|
||||
const isRenderable = !!(
|
||||
parameters.data.hasPopup ||
|
||||
parameters.data.title ||
|
||||
parameters.data.contents
|
||||
);
|
||||
super(parameters, isRenderable, /* ignoreBorder = */ true);
|
||||
}
|
||||
|
||||
|
@ -1081,7 +1128,7 @@ class CaretAnnotationElement extends AnnotationElement {
|
|||
* @returns {HTMLSectionElement}
|
||||
*/
|
||||
render() {
|
||||
this.container.className = 'caretAnnotation';
|
||||
this.container.className = "caretAnnotation";
|
||||
|
||||
if (!this.data.hasPopup) {
|
||||
this._createPopup(this.container, null, this.data);
|
||||
|
@ -1092,15 +1139,18 @@ class CaretAnnotationElement extends AnnotationElement {
|
|||
|
||||
class InkAnnotationElement extends AnnotationElement {
|
||||
constructor(parameters) {
|
||||
const isRenderable = !!(parameters.data.hasPopup ||
|
||||
parameters.data.title || parameters.data.contents);
|
||||
const isRenderable = !!(
|
||||
parameters.data.hasPopup ||
|
||||
parameters.data.title ||
|
||||
parameters.data.contents
|
||||
);
|
||||
super(parameters, isRenderable, /* ignoreBorder = */ true);
|
||||
|
||||
this.containerClassName = 'inkAnnotation';
|
||||
this.containerClassName = "inkAnnotation";
|
||||
|
||||
// Use the polyline SVG element since it allows us to use coordinates
|
||||
// directly and to draw both straight lines and curves.
|
||||
this.svgElementName = 'svg:polyline';
|
||||
this.svgElementName = "svg:polyline";
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1131,15 +1181,15 @@ class InkAnnotationElement extends AnnotationElement {
|
|||
const y = data.rect[3] - coordinate.y;
|
||||
points.push(`${x},${y}`);
|
||||
}
|
||||
points = points.join(' ');
|
||||
points = points.join(" ");
|
||||
|
||||
const polyline = this.svgFactory.createElement(this.svgElementName);
|
||||
polyline.setAttribute('points', points);
|
||||
polyline.setAttribute("points", points);
|
||||
// Ensure that the 'stroke-width' is always non-zero, since otherwise it
|
||||
// won't be possible to open/close the popup (note e.g. issue 11122).
|
||||
polyline.setAttribute('stroke-width', data.borderStyle.width || 1);
|
||||
polyline.setAttribute('stroke', 'transparent');
|
||||
polyline.setAttribute('fill', 'none');
|
||||
polyline.setAttribute("stroke-width", data.borderStyle.width || 1);
|
||||
polyline.setAttribute("stroke", "transparent");
|
||||
polyline.setAttribute("fill", "none");
|
||||
|
||||
// Create the popup ourselves so that we can bind it to the polyline
|
||||
// instead of to the entire container (which is the default).
|
||||
|
@ -1155,8 +1205,11 @@ class InkAnnotationElement extends AnnotationElement {
|
|||
|
||||
class HighlightAnnotationElement extends AnnotationElement {
|
||||
constructor(parameters) {
|
||||
const isRenderable = !!(parameters.data.hasPopup ||
|
||||
parameters.data.title || parameters.data.contents);
|
||||
const isRenderable = !!(
|
||||
parameters.data.hasPopup ||
|
||||
parameters.data.title ||
|
||||
parameters.data.contents
|
||||
);
|
||||
super(parameters, isRenderable, /* ignoreBorder = */ true);
|
||||
}
|
||||
|
||||
|
@ -1168,7 +1221,7 @@ class HighlightAnnotationElement extends AnnotationElement {
|
|||
* @returns {HTMLSectionElement}
|
||||
*/
|
||||
render() {
|
||||
this.container.className = 'highlightAnnotation';
|
||||
this.container.className = "highlightAnnotation";
|
||||
|
||||
if (!this.data.hasPopup) {
|
||||
this._createPopup(this.container, null, this.data);
|
||||
|
@ -1179,8 +1232,11 @@ class HighlightAnnotationElement extends AnnotationElement {
|
|||
|
||||
class UnderlineAnnotationElement extends AnnotationElement {
|
||||
constructor(parameters) {
|
||||
const isRenderable = !!(parameters.data.hasPopup ||
|
||||
parameters.data.title || parameters.data.contents);
|
||||
const isRenderable = !!(
|
||||
parameters.data.hasPopup ||
|
||||
parameters.data.title ||
|
||||
parameters.data.contents
|
||||
);
|
||||
super(parameters, isRenderable, /* ignoreBorder = */ true);
|
||||
}
|
||||
|
||||
|
@ -1192,7 +1248,7 @@ class UnderlineAnnotationElement extends AnnotationElement {
|
|||
* @returns {HTMLSectionElement}
|
||||
*/
|
||||
render() {
|
||||
this.container.className = 'underlineAnnotation';
|
||||
this.container.className = "underlineAnnotation";
|
||||
|
||||
if (!this.data.hasPopup) {
|
||||
this._createPopup(this.container, null, this.data);
|
||||
|
@ -1203,8 +1259,11 @@ class UnderlineAnnotationElement extends AnnotationElement {
|
|||
|
||||
class SquigglyAnnotationElement extends AnnotationElement {
|
||||
constructor(parameters) {
|
||||
const isRenderable = !!(parameters.data.hasPopup ||
|
||||
parameters.data.title || parameters.data.contents);
|
||||
const isRenderable = !!(
|
||||
parameters.data.hasPopup ||
|
||||
parameters.data.title ||
|
||||
parameters.data.contents
|
||||
);
|
||||
super(parameters, isRenderable, /* ignoreBorder = */ true);
|
||||
}
|
||||
|
||||
|
@ -1216,7 +1275,7 @@ class SquigglyAnnotationElement extends AnnotationElement {
|
|||
* @returns {HTMLSectionElement}
|
||||
*/
|
||||
render() {
|
||||
this.container.className = 'squigglyAnnotation';
|
||||
this.container.className = "squigglyAnnotation";
|
||||
|
||||
if (!this.data.hasPopup) {
|
||||
this._createPopup(this.container, null, this.data);
|
||||
|
@ -1227,8 +1286,11 @@ class SquigglyAnnotationElement extends AnnotationElement {
|
|||
|
||||
class StrikeOutAnnotationElement extends AnnotationElement {
|
||||
constructor(parameters) {
|
||||
const isRenderable = !!(parameters.data.hasPopup ||
|
||||
parameters.data.title || parameters.data.contents);
|
||||
const isRenderable = !!(
|
||||
parameters.data.hasPopup ||
|
||||
parameters.data.title ||
|
||||
parameters.data.contents
|
||||
);
|
||||
super(parameters, isRenderable, /* ignoreBorder = */ true);
|
||||
}
|
||||
|
||||
|
@ -1240,7 +1302,7 @@ class StrikeOutAnnotationElement extends AnnotationElement {
|
|||
* @returns {HTMLSectionElement}
|
||||
*/
|
||||
render() {
|
||||
this.container.className = 'strikeoutAnnotation';
|
||||
this.container.className = "strikeoutAnnotation";
|
||||
|
||||
if (!this.data.hasPopup) {
|
||||
this._createPopup(this.container, null, this.data);
|
||||
|
@ -1251,8 +1313,11 @@ class StrikeOutAnnotationElement extends AnnotationElement {
|
|||
|
||||
class StampAnnotationElement extends AnnotationElement {
|
||||
constructor(parameters) {
|
||||
const isRenderable = !!(parameters.data.hasPopup ||
|
||||
parameters.data.title || parameters.data.contents);
|
||||
const isRenderable = !!(
|
||||
parameters.data.hasPopup ||
|
||||
parameters.data.title ||
|
||||
parameters.data.contents
|
||||
);
|
||||
super(parameters, isRenderable, /* ignoreBorder = */ true);
|
||||
}
|
||||
|
||||
|
@ -1264,7 +1329,7 @@ class StampAnnotationElement extends AnnotationElement {
|
|||
* @returns {HTMLSectionElement}
|
||||
*/
|
||||
render() {
|
||||
this.container.className = 'stampAnnotation';
|
||||
this.container.className = "stampAnnotation";
|
||||
|
||||
if (!this.data.hasPopup) {
|
||||
this._createPopup(this.container, null, this.data);
|
||||
|
@ -1277,12 +1342,12 @@ class FileAttachmentAnnotationElement extends AnnotationElement {
|
|||
constructor(parameters) {
|
||||
super(parameters, /* isRenderable = */ true);
|
||||
|
||||
const { filename, content, } = this.data.file;
|
||||
const { filename, content } = this.data.file;
|
||||
this.filename = getFilenameFromUrl(filename);
|
||||
this.content = content;
|
||||
|
||||
if (this.linkService.eventBus) {
|
||||
this.linkService.eventBus.dispatch('fileattachmentannotation', {
|
||||
this.linkService.eventBus.dispatch("fileattachmentannotation", {
|
||||
source: this,
|
||||
id: stringToPDFString(filename),
|
||||
filename,
|
||||
|
@ -1300,12 +1365,12 @@ class FileAttachmentAnnotationElement extends AnnotationElement {
|
|||
* @returns {HTMLSectionElement}
|
||||
*/
|
||||
render() {
|
||||
this.container.className = 'fileAttachmentAnnotation';
|
||||
this.container.className = "fileAttachmentAnnotation";
|
||||
|
||||
const trigger = document.createElement('div');
|
||||
const trigger = document.createElement("div");
|
||||
trigger.style.height = this.container.style.height;
|
||||
trigger.style.width = this.container.style.width;
|
||||
trigger.addEventListener('dblclick', this._download.bind(this));
|
||||
trigger.addEventListener("dblclick", this._download.bind(this));
|
||||
|
||||
if (!this.data.hasPopup && (this.data.title || this.data.contents)) {
|
||||
this._createPopup(this.container, trigger, this.data);
|
||||
|
@ -1323,10 +1388,10 @@ class FileAttachmentAnnotationElement extends AnnotationElement {
|
|||
*/
|
||||
_download() {
|
||||
if (!this.downloadManager) {
|
||||
warn('Download cannot be started due to unavailable download manager');
|
||||
warn("Download cannot be started due to unavailable download manager");
|
||||
return;
|
||||
}
|
||||
this.downloadManager.downloadData(this.content, this.filename, '');
|
||||
this.downloadManager.downloadData(this.content, this.filename, "");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1363,7 +1428,7 @@ class AnnotationLayer {
|
|||
viewport: parameters.viewport,
|
||||
linkService: parameters.linkService,
|
||||
downloadManager: parameters.downloadManager,
|
||||
imageResourcesPath: parameters.imageResourcesPath || '',
|
||||
imageResourcesPath: parameters.imageResourcesPath || "",
|
||||
renderInteractiveForms: parameters.renderInteractiveForms || false,
|
||||
svgFactory: new DOMSVGFactory(),
|
||||
});
|
||||
|
@ -1383,16 +1448,16 @@ class AnnotationLayer {
|
|||
static update(parameters) {
|
||||
for (const data of parameters.annotations) {
|
||||
const element = parameters.div.querySelector(
|
||||
`[data-annotation-id="${data.id}"]`);
|
||||
`[data-annotation-id="${data.id}"]`
|
||||
);
|
||||
if (element) {
|
||||
element.style.transform =
|
||||
`matrix(${parameters.viewport.transform.join(',')})`;
|
||||
element.style.transform = `matrix(${parameters.viewport.transform.join(
|
||||
","
|
||||
)})`;
|
||||
}
|
||||
}
|
||||
parameters.div.removeAttribute('hidden');
|
||||
parameters.div.removeAttribute("hidden");
|
||||
}
|
||||
}
|
||||
|
||||
export {
|
||||
AnnotationLayer,
|
||||
};
|
||||
export { AnnotationLayer };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue