Skip to content

Commit 8e51959

Browse files
committed
[Editor] Commit the current drawing before switching the current mode
It fixes mozilla#19793.
1 parent 220a289 commit 8e51959

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/display/editor/tools.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1680,6 +1680,7 @@ class AnnotationEditorUIManager {
16801680
}
16811681

16821682
this.#updateModeCapability = Promise.withResolvers();
1683+
this.#currentDrawingSession?.commitOrRemove();
16831684

16841685
this.#mode = mode;
16851686
if (mode === AnnotationEditorType.NONE) {

src/display/touch_manager.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,9 +215,12 @@ class TouchManager {
215215
if (evt.touches.length >= 2) {
216216
return;
217217
}
218-
this.#touchMoveAC.abort();
219-
this.#touchMoveAC = null;
220-
this.#onPinchEnd?.();
218+
// #touchMoveAC shouldn't be null be it seems that irl it can (see #19793).
219+
if (this.#touchMoveAC) {
220+
this.#touchMoveAC.abort();
221+
this.#touchMoveAC = null;
222+
this.#onPinchEnd?.();
223+
}
221224

222225
if (!this.#touchInfo) {
223226
return;

0 commit comments

Comments
 (0)