Skip to content

Commit

Permalink
fix(annotations): Fix AnnotationControlsFSM reset when fullscreen enter
Browse files Browse the repository at this point in the history
  • Loading branch information
Mingze Xiao committed Nov 5, 2020
1 parent ede8e42 commit 82da743
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/lib/viewers/BaseViewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}

Expand Down
3 changes: 3 additions & 0 deletions src/lib/viewers/__tests__/BaseViewer-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand All @@ -535,6 +536,7 @@ describe('lib/viewers/BaseViewer', () => {
base.annotationControls = {
destroy: jest.fn(),
resetControls: jest.fn(),
setMode: jest.fn(),
toggle: jest.fn(),
};

Expand All @@ -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);
});
});

Expand Down
1 change: 0 additions & 1 deletion src/lib/viewers/doc/DocBaseViewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}

Expand Down
1 change: 0 additions & 1 deletion src/lib/viewers/doc/__tests__/DocBaseViewer-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
});
Expand Down

0 comments on commit 82da743

Please sign in to comment.