Skip to content

Commit 231294c

Browse files
author
Kevin Busch
committed
Added JSDocs to the sketchpad component
1 parent 20c0337 commit 231294c

1 file changed

Lines changed: 58 additions & 0 deletions

File tree

src/atoms/forms/canvas-sketch/react-canvas-sketch.tsx

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,82 @@ import { useEffect } from "react";
1111
// #region Interfaces
1212
// -------------------------------------------------------------------------------------------------
1313

14+
/**
15+
* Represents the objects containing all data necessary to redraw the sketch canvas at a point in
16+
* the history of the stack of drawing objects
17+
*/
1418
export interface ReactCanvasSketchValue {
19+
/**
20+
* The current point/index in the history stack of drawing objects
21+
*/
1522
currentObjectIndex: number;
23+
/**
24+
* The drawn objects stack
25+
*/
1626
objects: CanvasDrawToolSettings[];
1727
}
1828

29+
/**
30+
* Represents all properties supported by the <ReactCanvasSketch> component
31+
*/
1932
export interface ReactCanvasSketchProps {
33+
/**
34+
* The URL of the background image to be drawn to the sketchpad
35+
*/
2036
backgroundImageUrl: string;
37+
/**
38+
* The height of the canvas element
39+
*/
2140
canvasHeight: number;
41+
/**
42+
* The width of the canvas element
43+
*/
2244
canvasWidth: number;
45+
/**
46+
* The className that will be appended to the sketchpad's outer most container
47+
*/
2348
className: string;
49+
/**
50+
* The height of the container wrapping the sketchpad
51+
* NOTE: This can be smaller than the canvasHeight value since the sketchpad supports panning
52+
*/
2453
containerHeight: number;
54+
/**
55+
* The width of the container wrapping the sketchpad
56+
* NOTE: This can be smaller than the canvasWidth value since the sketchpad supports panning
57+
*/
2558
containerWidth: number;
59+
/**
60+
* Handler to allow caller to track added stroke settings whenever a tool draws a new object
61+
* to the drawn objects stack
62+
*/
2663
onAddedStroke: (strokeSettings: CanvasDrawToolSettings) => void;
64+
/**
65+
* Allows the caller to redraw the sketchpad by changing the numeric value provided
66+
*/
2767
redrawIncrement: number;
68+
/**
69+
* The tool to be selected by the canvas sketch library
70+
*/
2871
canvasToolType: CanvasToolType;
72+
/**
73+
* When true, displays a dashed border around the canvas to identify drawable area. When false,
74+
* hides the dashed border around the canvas.
75+
*/
2976
showCanvasBorder: boolean;
77+
/**
78+
* The width of the selected tool for use by the selected tool
79+
*/
3080
toolWidth: number;
81+
/**
82+
* The color of the selected tool for use by the selected tool
83+
*/
3184
toolColor: string;
85+
/**
86+
* The object literal containing all information necessary to redraw the objects containing all
87+
* data necessary to redraw the sketch canvas at a point in the history of the stack of drawing
88+
* objects
89+
*/
3290
value: ReactCanvasSketchValue;
3391
}
3492

0 commit comments

Comments
 (0)