You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+15-8Lines changed: 15 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,11 +16,17 @@ A Sketch tool for React based applications, backed-up by [FabricJS](http://fabri
16
16
npm install react-sketch --save
17
17
```
18
18
19
+
or with yarn
20
+
21
+
```sh
22
+
yarn add react-sketch
23
+
```
24
+
19
25
### Source installation
20
26
21
27
In order to build from source, read the [relevant instructions](http://fabricjs.com/fabric-intro-part-4#node) first.
22
28
23
-
Tested with node versions 4,5,6,7,8.
29
+
Tested with node versions 6,7,8.
24
30
25
31
## Usage
26
32
@@ -35,7 +41,7 @@ class SketchFieldDemo extends React.Component {
35
41
<SketchField width='1024px'
36
42
height='768px'
37
43
tool={Tools.Pencil}
38
-
color='black'
44
+
lineColor='black'
39
45
lineWidth={3}/>
40
46
)
41
47
}
@@ -54,10 +60,10 @@ Configuration Options
54
60
| undoSteps | Number | 15 | number of undo/redo steps to maintain |
55
61
| imageFormat | String | png | image format when calling toDataURL, can be png or jpeg |
56
62
| width | Number | No Value(null)| Set/control the canvas width, if left empty the sketch will scale to parent element |
57
-
| height | Number | 512 | Set/control the canvas height, if left empty the sketch will take a reasonable default height |
58
-
|defaultData| JSON or data URL ||Default initial data, can be json or URL data accroding to configuration option below, in the case of data URL the initial drawing will be imported as an image|
59
-
|defaultDataType| Enumeration (string) | json| The Type of initial data, can be either json or url|
60
-
| widthCorrection | Number | 2 | Specify some width correction which will be applied on resize of canvas, this will help to correct some possible border on the canvas style |
63
+
| height | Number | 512 | Set/control the canvas height, if left empty the sketch will take a reasonable default height |
64
+
|value| JSON|| Property to utilize and handle the sketch data as controlled component|
65
+
|defaultValue| JSON || Default initial data, to load. If value is set then value will be loaded instead |
66
+
| widthCorrection | Number | 2 | Specify some width correction which will be applied on resize of canvas, this will help to correct some possible border on the canvas style |
61
67
| heightCorrection | Number | 0 | Specify some height correction which will be applied on resize of canvas, this will help to correct some possible border on the canvas style |
62
68
63
69
@@ -67,6 +73,7 @@ Available tools
67
73
|--- |--- |
68
74
| Pencil | Free drawing pencil |
69
75
| Line | Gives you the ability to draw lines |
76
+
| Rectangle | Create rectangles |
70
77
| Circle | Create circles |
71
78
| Rectangle | Create Rectangles |
72
79
| Select | Disables drawing and gives you the ability to modify existing elements in the canvas |
@@ -79,11 +86,11 @@ The project includes a webpack server for running the examples, just run:
0 commit comments