From 99c62f9248e78c2606b70bda5af8a4ca52230c4c Mon Sep 17 00:00:00 2001 From: Calixte Denizet Date: Thu, 3 Aug 2023 10:51:47 +0200 Subject: [PATCH] [Editor] Stop the resize session when the window is blurred --- src/display/editor/editor.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/display/editor/editor.js b/src/display/editor/editor.js index c21d8c77a..131f71ee0 100644 --- a/src/display/editor/editor.js +++ b/src/display/editor/editor.js @@ -464,15 +464,18 @@ class AnnotationEditor { this._uiManager.stopUndoAccumulation(); this.div.draggable = savedDraggable; this.parent.div.classList.remove(resizingClassName); + window.removeEventListener("pointerup", pointerUpCallback); + window.removeEventListener("blur", pointerUpCallback); window.removeEventListener( "pointermove", boundResizerPointermove, pointerMoveOptions ); }; - window.addEventListener("pointerup", pointerUpCallback, { - once: true, - }); + window.addEventListener("pointerup", pointerUpCallback); + // If the user switch to another window (with alt+tab), then we end the + // resize session. + window.addEventListener("blur", pointerUpCallback); } #resizerPointermove(name, event) {