Constructor
The `BrushTool` constructor initialize a brush tool for creating and modifying annotations. It inherits from the `AnnotationUITool` class and includes methods to configure the tool's behavior, set the radius, set erase mode, and handle mouse events for drawing and erasing.
Parameters:
Name |
Type |
Description |
paperScope |
paper.PaperScope
|
The Paper.js PaperScope instance. |
Properties:
Name |
Type |
Description |
tool |
paper.Tool
|
The Paper.js tool instance for handling mouse events. |
eraseMode |
boolean
|
A flag indicating whether the tool is in Erase Mode or Draw Mode. |
drawColor |
paper.Color
|
The color for drawing strokes. |
eraseColor |
paper.Color
|
The color for erasing strokes. |
radius |
number
|
The current radius of the brush tool. |
cursor |
paper.Shape.Circle
|
The Paper.js Shape.Circle representing the cursor. |
pathGroup |
paper.Group
|
The Paper.js Group containing the drawing path and the cursor. |
- Source:
Extends
Classes
- BrushToolbar
Methods
setEraseMode(erase)
This method toggles the erase mode of the brush tool, changing whether it adds or subtracts strokes.
Parameters:
Name |
Type |
Description |
erase |
boolean
|
A flag indicating whether the tool should be in Erase Mode or Draw Mode. |
- Source:
setRadius(r)
This method sets the radius of the brush tool, affecting the size of the brush strokes.
Parameters:
Name |
Type |
Description |
r |
number
|
The new radius value for the brush. |
- Source: