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
{{ message }}
This repository was archived by the owner on Aug 1, 2022. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+14-3Lines changed: 14 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -58,7 +58,15 @@ These are the defaultProps of CanvasDraw. You can pass along any of these props
58
58
imgSrc:"",
59
59
saveData:null,
60
60
immediateLoading:false,
61
-
hideInterface:false
61
+
hideInterface:false,
62
+
gridSizeX:25,
63
+
gridSizeY:25,
64
+
gridLineWidth:0.5,
65
+
hideGridX:false,
66
+
hideGridY:false
67
+
enablePanAndZoom:false,
68
+
mouseZoomFactor:0.01,
69
+
zoomExtents: { min:0.33, max:3 },
62
70
};
63
71
```
64
72
@@ -68,7 +76,10 @@ Useful functions that you can call, e.g. when having a reference to this compone
68
76
69
77
-`getSaveData()` returns the drawing's save-data as a stringified object
70
78
-`loadSaveData(saveData: String, immediate: Boolean)` loads a previously saved drawing using the saveData string, as well as an optional boolean flag to load it immediately, instead of live-drawing it.
71
-
-`clear()` clears the canvas completely
79
+
-`getDataURL(fileType, useBgImage, backgroundColour)` will export the canvas to a data URL, which can subsequently be used to share or manipulate the image file.
80
+
-`clear()` clears the canvas completely, including previously erased lines, and resets the view. After a clear, `undo()` will have no effect.
81
+
-`eraseAll()` clears the drawn lines but retains their data; calling `undo()` can restore the erased lines. _Note: erased lines are not included in the save data._
82
+
-`resetView()` resets the canvas' view to defaults. Has no effect if the `enablePanAndZoom` property is `false`.
72
83
-`undo()` removes the latest change to the drawing. This includes everything drawn since the last MouseDown event.
73
84
74
85
## Local Development
@@ -79,7 +90,7 @@ You just need to clone it, yarn it & start it!
79
90
80
91
## Tips
81
92
82
-
If you want to save large strings, like the stringified JSON of a drawing, I recommend you to use [pieroxy/lz-string](https://github.com/pieroxy/lz-string) for compression. It's LZ compression will bring down your long strings to only ~10% of it's original size.
93
+
If you want to save large strings, like the stringified JSON of a drawing, I recommend you use [pieroxy/lz-string](https://github.com/pieroxy/lz-string) for compression. It's LZ compression will bring down your long strings to only ~10% of its original size.
0 commit comments