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
+10-16Lines changed: 10 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -224,26 +224,23 @@ Click and drag on the canvas to draw, change modes to erase. The brush color and
224
224
See [example](https://harshkhandeparkar.github.io/gpujs-real-renderer).
225
225
226
226
##### Properties (Read-Only)
227
-
- `brushSize` (*number*): The radius of the drawing brush. The size is measured in the board's
228
-
arbitrary coordinate system.
229
-
- `brushColor` (*array*): The color of the brush in the form `[red, green, blue]` where each of
230
-
`red`, `green` and `blue` are between 0 and 1.
231
-
- `eraserSize` (*number*): Size of the eraser.
232
-
- `tool` ('brush' | 'rainbow_brush' | 'eraser' | 'line'): The current tool used on the board. This tool can be set in the options or using the `changeTool` method.
227
+
- `tool` (`'brush'` | `'rainbow_brush'` | `'eraser'` | `'line'`): The current tool used on the board. This tool can be set in the options or using the `changeTool` method.
233
228
- `brush`: Normal brush which uses the `brushColor` property as the color.
234
229
- `rainbow_brush`: Brush with continuously changing color.
235
230
- `eraser`: Erases.
236
231
- `line`: Draws a line with `brushColor` property as the color.
232
+
- `toolSettings` (`Object`): Settings for all the different tools. It contains the following properties.
233
+
- `brushSize` (`number`): Size of the `brush` tool and `rainbow_brush` tool.
234
+
- `brushColor` (`[number, number, number]`): Color of the `brush` tool.
235
+
- `eraserSize` (`number`): Size of the `eraser` tool.
236
+
- `lineThickness` (`number`): Thickness of the `line` tool.
237
+
- `lineColor` (`[number, number, number]`): Color of the `line` tool.
238
+
- `changeRate` (`number`): Rate at which the `rainbow_brush` tool changes color.
237
239
238
240
##### Options
239
241
Since this is a child class of `RealRenderer`, all the options of `RealRender` are applicable here as well.
240
242
Apart from those, the following are additional options that can be passed on to the constructor.
241
-
242
-
- `brushSize`(*Number*) (Default: `1`): Determines the size of the brush, i.e. the thickness of the stroke.
243
-
244
-
- `brushColor`(*Array*) (Default: `[1, 1, 1]`): The color of the brush, i.e. the plotted points.
245
-
246
-
- `eraserSize`(*Number*) (Default: `2`): Determines the size of the eraser.
243
+
- `toolSettings` (`Object`): Settings for all the different tools. Same as described in the **properties** section above.
247
244
248
245
- `allowUndo`(*Boolean*) (Default: `false`): Determines the maximum possible undos. (Use a smaller number on devices with less RAM)
249
246
@@ -256,11 +253,8 @@ Since this is a child class of `RealRenderer`, all the methods of `RealRender` a
256
253
Apart from these methods, the following new methods are also available and are chainable too.
257
254
258
255
- `startRender()` and `stopRender()`: Slightly different compared to `RealRenderer` but they don't draw continously.
259
-
260
-
- `changeBrushColor(newColor)`: Change the brush color.
261
-
- `changeBrushSize(newSize)`: Change the brush size.
262
-
- `changeEraserSize(newSize)`: Change the eraser size.
263
256
- `changeTool(newTool)`: Change the tool.
257
+
- `changeToolSetting(settingName, value)`: Changes a specific setting in the `toolSettings` *property*. See **properties** section above.
264
258
- `undo(numUndos =1)`: Undoes the specified number of brush strokes. (Defualt: undoes one stroke)
265
259
- `redo(numUndos =1)`: Redoes the specified number of brush strokes. (Defualt: redoes one stroke)
0 commit comments