Fix resetting of cursor-tools when closing the document (PR 17464 follow-up)

With the removal of the "secondarytoolbarreset" event in PR 17464 resetting of cursor-tools state accidentally broke.
This commit is contained in:
Jonas Jenwald 2024-04-12 13:16:44 +02:00
parent e78ce74b5f
commit 60832fee27
2 changed files with 9 additions and 10 deletions

View file

@ -106,7 +106,14 @@ class PDFCursorTools {
#addEventListeners() {
this.eventBus._on("switchcursortool", evt => {
this.switchTool(evt.tool);
if (!evt.reset) {
this.switchTool(evt.tool);
} else if (this.#prevActive !== null) {
annotationEditorMode = AnnotationEditorType.NONE;
presentationModeState = PresentationModeState.NORMAL;
enableActive();
}
});
let annotationEditorMode = AnnotationEditorType.NONE,
@ -131,15 +138,6 @@ class PDFCursorTools {
}
};
this.eventBus._on("secondarytoolbarreset", evt => {
if (this.#prevActive !== null) {
annotationEditorMode = AnnotationEditorType.NONE;
presentationModeState = PresentationModeState.NORMAL;
enableActive();
}
});
this.eventBus._on("annotationeditormodechanged", ({ mode }) => {
annotationEditorMode = mode;