[Editor] Avoid creation of an editor on "wrong" clicks
This commit is contained in:
parent
0079ce4ad0
commit
71ca249d2b
@ -49,6 +49,8 @@ class AnnotationEditorLayer {
|
|||||||
|
|
||||||
#editors = new Map();
|
#editors = new Map();
|
||||||
|
|
||||||
|
#hadPointerDown = false;
|
||||||
|
|
||||||
#isCleaningUp = false;
|
#isCleaningUp = false;
|
||||||
|
|
||||||
#textLayerMap = new WeakMap();
|
#textLayerMap = new WeakMap();
|
||||||
@ -597,6 +599,15 @@ class AnnotationEditorLayer {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!this.#hadPointerDown) {
|
||||||
|
// It can happen when the user starts a drag inside a text editor
|
||||||
|
// and then releases the mouse button outside of it. In such a case
|
||||||
|
// we don't want to create a new editor, hence we check that a pointerdown
|
||||||
|
// occured on this div previously.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.#hadPointerDown = false;
|
||||||
|
|
||||||
if (!this.#allowClick) {
|
if (!this.#allowClick) {
|
||||||
this.#allowClick = true;
|
this.#allowClick = true;
|
||||||
return;
|
return;
|
||||||
@ -620,6 +631,8 @@ class AnnotationEditorLayer {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.#hadPointerDown = true;
|
||||||
|
|
||||||
const editor = this.#uiManager.getActive();
|
const editor = this.#uiManager.getActive();
|
||||||
this.#allowClick = !editor || editor.isEmpty();
|
this.#allowClick = !editor || editor.isEmpty();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user