@@ -65,33 +65,33 @@ This value should not be changed after ReactPainter is mounted as it will mess u
6565Set the width of the canvas
6666Similar to height, this value should not be changed after mounted.
6767
68- ### color ?: string
68+ ### initialColor ?: string
6969
7070> defaults to ` #000 `
7171
72- Set the stroke color.
73- This value can be changed dynamically.
72+ Set the initial stroke color.
73+ Stroke can be changed dynamically using ` setColor ` .
7474
75- ### lineWidth ?: number
75+ ### initialLineWidth ?: number
7676
7777> defaults to ` 5 `
7878
79- Set the stroke line width.
80- This value can be changed dynamically.
79+ Set the initial stroke line width.
80+ Line width can be changed dynamically using ` setLineWidth ` .
8181
8282### lineCap?: 'round' | 'butt' | 'square'
8383
8484> defaults to ` round `
8585
86- Set the stroke line cap.
87- This value can be changed dynamically.
86+ Set the initial stroke line cap.
87+ Line cap can be changed dynamically using ` setLineCap ` .
8888
89- ### lineJoin ?: 'round' | 'bevel' | 'miter'
89+ ### initialLineJoin ?: 'round' | 'bevel' | 'miter'
9090
9191> defaults to ` round `
9292
93- Set the stroke line join.
94- This value can be changed dynamically.
93+ Set the initial stroke line join.
94+ Line join type can be changed dynamically using ` setLineJoin ` .
9595
9696### onSave?: (blob: Blob) => void
9797
@@ -129,7 +129,7 @@ This is the canvas node that you can used to mount in your component. Example:
129129/ >
130130```
131131
132- ### triggerSave: () => void;
132+ ### triggerSave: () => void
133133
134134This is the function that you invoke when you want to save the canvas.
135135
@@ -147,7 +147,91 @@ Example:
147147/ >
148148```
149149
150- ### imageCanDownload: boolean;
150+ ### setColor: (color: string) => void
151+
152+ Set the color of the line.
153+
154+ Example:
155+
156+ ``` jsx
157+ < ReactPainter
158+ render= {({ canvas, triggerSave, setColor }) => (
159+ < div>
160+ < div> Awesome heading< / div>
161+ < input type= " color" onChange= {e => setColor (e .target .value )} / >
162+ < div className= " awesomeContainer" > {canvas}< / div>
163+ < button onClick= {triggerSave}> Save< / button>
164+ < / div>
165+ )}
166+ / >
167+ ```
168+
169+ ### setLineWidth: (width: number) => void
170+
171+ Set the width of the line.
172+
173+ Example:
174+
175+ ``` jsx
176+ < ReactPainter
177+ render= {({ canvas, triggerSave, setLineWidth }) => (
178+ < div>
179+ < div> Awesome heading< / div>
180+ < input type= " number" onChange= {e => setLineWidth (e .target .value )} / >
181+ < div className= " awesomeContainer" > {canvas}< / div>
182+ < button onClick= {triggerSave}> Save< / button>
183+ < / div>
184+ )}
185+ / >
186+ ```
187+
188+ ### setLineJoin: (type: 'round' | 'bevel' | 'miter') => void
189+
190+ Set the join type of the line.
191+
192+ Example:
193+
194+ ``` jsx
195+ < ReactPainter
196+ render= {({ canvas, triggerSave, setLineJoin }) => (
197+ < div>
198+ < div> Awesome heading< / div>
199+ < select onChange= {e => setLineJoin (e .target .value )}>
200+ < option value= " round" > round< / option>
201+ < option value= " bevel" > bevel< / option>
202+ < option value= " miter" > miter< / option>
203+ < / selct>
204+ < div className= " awesomeContainer" > {canvas}< / div>
205+ < button onClick= {triggerSave}> Save< / button>
206+ < / div>
207+ )}
208+ / >
209+ ```
210+
211+ ### setLineCap: (type: 'round' | 'butt' | 'square') => void
212+
213+ Set the cap type of the line.
214+
215+ Example:
216+
217+ ``` jsx
218+ < ReactPainter
219+ render= {({ canvas, triggerSave, setLineCap }) => (
220+ < div>
221+ < h2> Awesome heading< / h2>
222+ < select onChange= {e => setLineCap (e .target .value )}>
223+ < option value= " round" > round< / option>
224+ < option value= " butt" > butt< / option>
225+ < option value= " square" > square< / option>
226+ < / selct>
227+ < div className= " awesomeContainer" > {canvas}< / div>
228+ < button onClick= {triggerSave}> Save< / button>
229+ < / div>
230+ )}
231+ / >
232+ ```
233+
234+ ### imageCanDownload: boolean
151235
152236This properties let you know if the image is inserted successfully. By default it is ` null ` until the checking of image import is successful.
153237
0 commit comments