Skip to content

Commit 8e2963c

Browse files
authored
Merge pull request #20226 from lab-core/pointer-type-initialization
[Editor] Pointer type initialization only when the user changes the mode
2 parents 4aca13e + 396cff5 commit 8e2963c

3 files changed

Lines changed: 9 additions & 1 deletion

File tree

src/display/editor/draw.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -824,7 +824,6 @@ class DrawingEditor extends AnnotationEditor {
824824
this._currentParent = null;
825825
DrawingEditor.#currentDraw = null;
826826
DrawingEditor.#currentDrawingOptions = null;
827-
CurrentPointers.clearPointerType();
828827
CurrentPointers.clearTimeStamp();
829828
}
830829

src/display/editor/tools.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1923,6 +1923,8 @@ class AnnotationEditorUIManager {
19231923
* Change the editor mode (None, FreeText, Ink, ...)
19241924
* @param {number} mode
19251925
* @param {string|null} editId
1926+
* @param {boolean} [isFromUser] - true if the mode change is due to a
1927+
* user action.
19261928
* @param {boolean} [isFromKeyboard] - true if the mode change is due to a
19271929
* keyboard action.
19281930
* @param {boolean} [mustEnterInEditMode] - true if the editor must enter in
@@ -1933,6 +1935,7 @@ class AnnotationEditorUIManager {
19331935
async updateMode(
19341936
mode,
19351937
editId = null,
1938+
isFromUser = false,
19361939
isFromKeyboard = false,
19371940
mustEnterInEditMode = false,
19381941
editComment = false
@@ -1980,6 +1983,11 @@ class AnnotationEditorUIManager {
19801983
await this.#signatureManager?.loadSignatures();
19811984
}
19821985

1986+
if (isFromUser) {
1987+
// reinitialize the pointer type when the mode is changed by the user
1988+
CurrentPointers.clearPointerType();
1989+
}
1990+
19831991
this.setEditingState(true);
19841992
await this.#enableAll();
19851993
this.unselectAll();

web/pdf_viewer.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2501,6 +2501,7 @@ class PDFViewer {
25012501
await this.#annotationEditorUIManager.updateMode(
25022502
mode,
25032503
editId,
2504+
/* isFromUser = */ true,
25042505
isFromKeyboard,
25052506
mustEnterInEditMode,
25062507
editComment

0 commit comments

Comments
 (0)