mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-19 22:58:07 +02:00
[Editor] Don't commit the current drawing while zooming
This commit is contained in:
parent
99eefb7b71
commit
166a529ddd
2 changed files with 22 additions and 0 deletions
|
@ -76,6 +76,8 @@ class AnnotationEditorLayer {
|
|||
|
||||
#drawingAC = null;
|
||||
|
||||
#focusedElement = null;
|
||||
|
||||
#textLayer = null;
|
||||
|
||||
#textSelectionAC = null;
|
||||
|
@ -811,6 +813,7 @@ class AnnotationEditorLayer {
|
|||
"blur",
|
||||
({ relatedTarget }) => {
|
||||
if (relatedTarget && !this.div.contains(relatedTarget)) {
|
||||
this.#focusedElement = null;
|
||||
this.commitOrRemove();
|
||||
}
|
||||
},
|
||||
|
@ -819,6 +822,22 @@ class AnnotationEditorLayer {
|
|||
this.#currentEditorType.startDrawing(this, this.#uiManager, false, event);
|
||||
}
|
||||
|
||||
pause(on) {
|
||||
if (on) {
|
||||
const { activeElement } = document;
|
||||
if (this.div.contains(activeElement)) {
|
||||
this.#focusedElement = activeElement;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (this.#focusedElement) {
|
||||
setTimeout(() => {
|
||||
this.#focusedElement?.focus();
|
||||
this.#focusedElement = null;
|
||||
}, 0);
|
||||
}
|
||||
}
|
||||
|
||||
endDrawingSession(isAborted = false) {
|
||||
if (!this.#drawingAC) {
|
||||
return null;
|
||||
|
@ -826,6 +845,7 @@ class AnnotationEditorLayer {
|
|||
this.#uiManager.setCurrentDrawingSession(null);
|
||||
this.#drawingAC.abort();
|
||||
this.#drawingAC = null;
|
||||
this.#focusedElement = null;
|
||||
return this.#currentEditorType.endDrawing(isAborted);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue