From 976fa7bbd6859c47486cf48bb8650bf52d0f1108 Mon Sep 17 00:00:00 2001 From: Mingze Date: Wed, 29 Apr 2020 10:53:07 -0700 Subject: [PATCH] feat(annotations): Support multiple annotations at a time (#1201) --- src/lib/viewers/BaseViewer.js | 3 --- src/lib/viewers/__tests__/BaseViewer-test.js | 14 -------------- 2 files changed, 17 deletions(-) diff --git a/src/lib/viewers/BaseViewer.js b/src/lib/viewers/BaseViewer.js index a4c235ac1..4f5268026 100644 --- a/src/lib/viewers/BaseViewer.js +++ b/src/lib/viewers/BaseViewer.js @@ -1105,9 +1105,6 @@ class BaseViewer extends EventEmitter { // Only on success do we exit create annotation mode. If error occurs, // we remain in create mode if (status === 'success') { - const activeMode = this.annotationControls.getActiveMode(); - this.annotator.toggleAnnotationMode(activeMode); - this.annotationControls.resetControls(); this.annotator.emit('annotations_active_set', id); } } diff --git a/src/lib/viewers/__tests__/BaseViewer-test.js b/src/lib/viewers/__tests__/BaseViewer-test.js index 2e2f833d7..87da25b6e 100644 --- a/src/lib/viewers/__tests__/BaseViewer-test.js +++ b/src/lib/viewers/__tests__/BaseViewer-test.js @@ -1495,13 +1495,7 @@ describe('lib/viewers/BaseViewer', () => { describe('handleAnnotationCreateEvent()', () => { beforeEach(() => { - base.annotationControls = { - getActiveMode: sandbox.stub(), - resetControls: sandbox.stub(), - }; - base.annotator = { - toggleAnnotationMode: sandbox.stub(), emit: sandbox.stub(), }; }); @@ -1518,22 +1512,14 @@ describe('lib/viewers/BaseViewer', () => { const event = createEvent(status); base.handleAnnotationCreateEvent(event); - expect(base.annotationControls.getActiveMode).not.to.be.called; - expect(base.annotator.toggleAnnotationMode).not.to.be.called; - expect(base.annotationControls.resetControls).not.to.be.called; expect(base.annotator.emit).not.to.be.called; }); }); it('should reset controls if status is success', () => { - base.annotationControls.getActiveMode.returns('region'); - const event = createEvent('success'); base.handleAnnotationCreateEvent(event); - expect(base.annotationControls.getActiveMode).to.be.called; - expect(base.annotator.toggleAnnotationMode).to.be.calledWith('region'); - expect(base.annotationControls.resetControls).to.be.called; expect(base.annotator.emit).to.be.calledWith('annotations_active_set', '123'); }); });