Only activate ink editor if none is selected

This commit is contained in:
Calixte Denizet 2022-06-20 22:24:04 +02:00
parent 8d154d7f6a
commit c44ab94d28
2 changed files with 13 additions and 1 deletions

View File

@ -113,7 +113,11 @@ class AnnotationEditorLayer {
* @param {MouseEvent} event
*/
mouseover(event) {
if (event.target === this.div && event.buttons === 0) {
if (
event.target === this.div &&
event.buttons === 0 &&
!this.#uiManager.hasActive()
) {
// The div is the target so there is no ink editor, hence we can
// create a new one.
// event.buttons === 0 is here to avoid adding a new ink editor

View File

@ -570,6 +570,14 @@ class AnnotationEditorUIManager {
return this.#activeEditor;
}
/**
* Check if there is an active editor.
* @returns {boolean}
*/
hasActive() {
return this.#activeEditor !== null;
}
/**
* Get the current editor mode.
* @returns {number}