diff --git a/src/lib/viewers/BaseViewer.js b/src/lib/viewers/BaseViewer.js index e707abc04b..cabb59ef39 100644 --- a/src/lib/viewers/BaseViewer.js +++ b/src/lib/viewers/BaseViewer.js @@ -575,8 +575,8 @@ class BaseViewer extends EventEmitter { if (this.annotator && this.areNewAnnotationsEnabled()) { this.annotator.emit(ANNOTATOR_EVENT.setVisibility, false); - this.annotator.toggleAnnotationMode(AnnotationMode.NONE); this.disableAnnotationControls(); + this.processAnnotationModeChange(this.annotationControlsFSM.transition(AnnotationInput.RESET)); } } diff --git a/src/lib/viewers/__tests__/BaseViewer-test.js b/src/lib/viewers/__tests__/BaseViewer-test.js index af5793e2b4..321ea31f26 100644 --- a/src/lib/viewers/__tests__/BaseViewer-test.js +++ b/src/lib/viewers/__tests__/BaseViewer-test.js @@ -527,6 +527,7 @@ describe('lib/viewers/BaseViewer', () => { test('should hide annotations and toggle annotations mode', () => { jest.spyOn(base, 'areNewAnnotationsEnabled').mockReturnValue(true); jest.spyOn(base, 'disableAnnotationControls'); + jest.spyOn(base, 'processAnnotationModeChange'); base.annotator = { emit: jest.fn(), @@ -535,6 +536,7 @@ describe('lib/viewers/BaseViewer', () => { base.annotationControls = { destroy: jest.fn(), resetControls: jest.fn(), + setMode: jest.fn(), toggle: jest.fn(), }; @@ -543,6 +545,7 @@ describe('lib/viewers/BaseViewer', () => { expect(base.annotator.emit).toBeCalledWith(ANNOTATOR_EVENT.setVisibility, false); expect(base.annotator.toggleAnnotationMode).toBeCalledWith(AnnotationMode.NONE); expect(base.disableAnnotationControls).toBeCalled(); + expect(base.processAnnotationModeChange).toBeCalledWith(AnnotationMode.NONE); }); }); diff --git a/src/lib/viewers/doc/DocBaseViewer.js b/src/lib/viewers/doc/DocBaseViewer.js index 07ec446013..5f7fd04cf3 100644 --- a/src/lib/viewers/doc/DocBaseViewer.js +++ b/src/lib/viewers/doc/DocBaseViewer.js @@ -1283,7 +1283,6 @@ class DocBaseViewer extends BaseViewer { if (this.annotator && this.areNewAnnotationsEnabled() && this.options.enableAnnotationsDiscoverability) { this.annotator.toggleAnnotationMode(AnnotationMode.REGION); - this.processAnnotationModeChange(this.annotationControlsFSM.transition(AnnotationInput.RESET)); } } diff --git a/src/lib/viewers/doc/__tests__/DocBaseViewer-test.js b/src/lib/viewers/doc/__tests__/DocBaseViewer-test.js index cd8b2debf8..9861b005c0 100644 --- a/src/lib/viewers/doc/__tests__/DocBaseViewer-test.js +++ b/src/lib/viewers/doc/__tests__/DocBaseViewer-test.js @@ -1977,7 +1977,6 @@ describe('src/lib/viewers/doc/DocBaseViewer', () => { expect(docBase.annotator.emit).toBeCalledWith(ANNOTATOR_EVENT.setVisibility, true); expect(docBase.annotator.toggleAnnotationMode).toBeCalledWith(AnnotationMode.REGION); - expect(docBase.processAnnotationModeChange).toBeCalledWith(AnnotationMode.NONE); expect(docBase.enableAnnotationControls).toBeCalled(); }); });