Skip to content

Commit

Permalink
feat(annotations): Support multiple annotations at a time (#1201)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mingze authored Apr 29, 2020
1 parent e5d105d commit 976fa7b
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 17 deletions.
3 changes: 0 additions & 3 deletions src/lib/viewers/BaseViewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down
14 changes: 0 additions & 14 deletions src/lib/viewers/__tests__/BaseViewer-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
};
});
Expand All @@ -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');
});
});
Expand Down

0 comments on commit 976fa7b

Please sign in to comment.