mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
[Editor] Make the annotation editor layer invisible when disabled and empty
It'll help to avoid to consider them when the browser is restyling.
This commit is contained in:
parent
2d87a2eb1c
commit
185281957d
2 changed files with 22 additions and 6 deletions
|
@ -84,6 +84,10 @@ class AnnotationEditorLayer {
|
|||
this.#uiManager.addLayer(this);
|
||||
}
|
||||
|
||||
get isEmpty() {
|
||||
return this.#editors.size === 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the toolbar if it's required to reflect the tool currently used.
|
||||
* @param {number} mode
|
||||
|
@ -107,11 +111,17 @@ class AnnotationEditorLayer {
|
|||
}
|
||||
this.#uiManager.unselectAll();
|
||||
|
||||
this.div.classList.toggle(
|
||||
"freeTextEditing",
|
||||
mode === AnnotationEditorType.FREETEXT
|
||||
);
|
||||
this.div.classList.toggle("inkEditing", mode === AnnotationEditorType.INK);
|
||||
if (mode !== AnnotationEditorType.NONE) {
|
||||
this.div.classList.toggle(
|
||||
"freeTextEditing",
|
||||
mode === AnnotationEditorType.FREETEXT
|
||||
);
|
||||
this.div.classList.toggle(
|
||||
"inkEditing",
|
||||
mode === AnnotationEditorType.INK
|
||||
);
|
||||
this.div.hidden = false;
|
||||
}
|
||||
}
|
||||
|
||||
addInkEditorIfNeeded(isCommitting) {
|
||||
|
@ -172,6 +182,10 @@ class AnnotationEditorLayer {
|
|||
for (const editor of this.#editors.values()) {
|
||||
editor.disableEditing();
|
||||
}
|
||||
this.#cleanup();
|
||||
if (this.isEmpty) {
|
||||
this.div.hidden = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue