Skip to content

Commit 03c28f5

Browse files
author
HarshKhandeparkar
committed
docs<RealDrawBoard>: new tool changes
1 parent 4d7794e commit 03c28f5

File tree

1 file changed

+10
-16
lines changed

1 file changed

+10
-16
lines changed

README.md

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -224,26 +224,23 @@ Click and drag on the canvas to draw, change modes to erase. The brush color and
224224
See [example](https://harshkhandeparkar.github.io/gpujs-real-renderer).
225225
226226
##### 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.
233228
- `brush`: Normal brush which uses the `brushColor` property as the color.
234229
- `rainbow_brush`: Brush with continuously changing color.
235230
- `eraser`: Erases.
236231
- `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.
237239
238240
##### Options
239241
Since this is a child class of `RealRenderer`, all the options of `RealRender` are applicable here as well.
240242
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.
247244
248245
- `allowUndo`(*Boolean*) (Default: `false`): Determines the maximum possible undos. (Use a smaller number on devices with less RAM)
249246
@@ -256,11 +253,8 @@ Since this is a child class of `RealRenderer`, all the methods of `RealRender` a
256253
Apart from these methods, the following new methods are also available and are chainable too.
257254
258255
- `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.
263256
- `changeTool(newTool)`: Change the tool.
257+
- `changeToolSetting(settingName, value)`: Changes a specific setting in the `toolSettings` *property*. See **properties** section above.
264258
- `undo(numUndos = 1)`: Undoes the specified number of brush strokes. (Defualt: undoes one stroke)
265259
- `redo(numUndos = 1)`: Redoes the specified number of brush strokes. (Defualt: redoes one stroke)
266260
- `clear()`: Clears the board.

0 commit comments

Comments
 (0)