@@ -9,6 +9,8 @@ import propTypes from 'prop-types';
9
9
* @prop {number } size - The size of the brush.
10
10
* @prop {boolean } active - Whether the canvas can be doodled on at this time
11
11
* @prop {HTMLElement } attachedElement - Which element the DoodleCanvas should cover.
12
+ * @prop {Array<import('../types/api').DoodleLine> } lines - An array of lines that compose this doodle.
13
+ * @prop {Function } setLines - A function to set the lines
12
14
*/
13
15
14
16
/**
@@ -20,8 +22,14 @@ import propTypes from 'prop-types';
20
22
*
21
23
* @param {DoodleCanvasProps } props
22
24
*/
23
- const DoodleCanvas = ( { tool, size, active, attachedElement } ) => {
24
- const [ lines , setLines ] = useState ( /** @type {array } */ ( [ ] ) ) ;
25
+ const DoodleCanvas = ( {
26
+ tool,
27
+ size,
28
+ active,
29
+ attachedElement,
30
+ lines,
31
+ setLines,
32
+ } ) => {
25
33
const [ isDrawing , setIsDrawing ] = useState ( false ) ;
26
34
27
35
const handleMouseDown = e => {
@@ -103,6 +111,8 @@ DoodleCanvas.propTypes = {
103
111
tool : propTypes . string . isRequired ,
104
112
size : propTypes . number . isRequired ,
105
113
active : propTypes . bool . isRequired ,
114
+ lines : propTypes . array . isRequired ,
115
+ setLines : propTypes . func . isRequired ,
106
116
attachedElement : propTypes . any . isRequired ,
107
117
} ;
108
118
0 commit comments