diff --git a/__tests__/AnnotationCreation.test.js b/__tests__/AnnotationCreation.test.js index 5f79a8291da2447385a5c2ff82ac5120400d13bf..d0a355d746333ab1330cbdc119c99fa262a45b2e 100644 --- a/__tests__/AnnotationCreation.test.js +++ b/__tests__/AnnotationCreation.test.js @@ -10,7 +10,7 @@ function createWrapper(props) { return shallow( <AnnotationCreation id="x" - config={{}} + config={{ annotation: {} }} receiveAnnotation={jest.fn()} windowId="abc" {...props} diff --git a/src/AnnotationCreation.js b/src/AnnotationCreation.js index 54d09c628acf4da5703376bc93a83887a3584e21..3ce88cfe035ab4bb3b5c2f0a2ec3ff77bcaaa233 100644 --- a/src/AnnotationCreation.js +++ b/src/AnnotationCreation.js @@ -64,18 +64,24 @@ class AnnotationCreation extends Component { } } } - this.state = { + + const toolState = { activeTool: 'cursor', - annoBody: '', closedMode: 'closed', - colorPopoverOpen: false, currentColorType: false, fillColor: null, + strokeColor: '#00BFFF', + strokeWidth: 3, + ...(props.config.annotation.defaults || {}), + }; + + this.state = { + ...toolState, + annoBody: '', + colorPopoverOpen: false, lineWeightPopoverOpen: false, popoverAnchorEl: null, popoverLineWeightAnchorEl: null, - strokeColor: '#00BFFF', - strokeWidth: 1, svg: null, xywh: null, ...annoState, @@ -428,6 +434,7 @@ AnnotationCreation.propTypes = { config: PropTypes.shape({ annotation: PropTypes.shape({ adapter: PropTypes.func, + defaults: PropTypes.objectOf(PropTypes.string), }), }).isRequired, id: PropTypes.string.isRequired,