From 956249d5f1de21b8ab4b2e44726ea0ca09c8a8e2 Mon Sep 17 00:00:00 2001
From: Chris Beer <chris@cbeer.info>
Date: Wed, 16 Jun 2021 09:53:54 -0700
Subject: [PATCH] Increase the default stroke width for annotations, and allow
 applications to override that with some configuration

---
 __tests__/AnnotationCreation.test.js |  2 +-
 src/AnnotationCreation.js            | 17 ++++++++++++-----
 2 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/__tests__/AnnotationCreation.test.js b/__tests__/AnnotationCreation.test.js
index 5f79a82..d0a355d 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 54d09c6..3ce88cf 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,
-- 
GitLab