Overview
The WeaveBrushToolAction class that enables users to draw freeform strokes on the canvas using a brush tool. It lets users click and drag across the canvas to create a smooth, continuous path—perfect for sketching, annotating, or freehand drawing within a collaborative environment.
Each stroke is recorded as a WeaveLineNode, synchronized across all connected users in real time.
The class extends the WeaveAction class.
TypeScript types
type WeaveBrushToolActionProperties = {
interpolationSteps: number; // Number of steps for interpolation
simplifyTolerance: number; // Douglas-Peucker tolerance applied on stroke finalize
};
type WeaveBrushToolActionParams = {
config: Partial<WeaveBrushToolActionProperties>;
};
Parameters
For WeaveBrushToolActionParams:
| Property | Type | Required | Description |
|---|---|---|---|
|
|
Required |
Config parameters for the tool. |
For WeaveBrushToolActionProperties:
| Property | Type | Required | Default | Description |
|---|---|---|---|---|
|
|
|
Number of interpolation steps for smooth curve on touch devices. |
|
|
|
|
Tolerance, in canvas units, of the Douglas-Peucker simplification applied once when a stroke is finalized. While a stroke is being drawn every recorded sample is rendered; on release the point list is simplified before being persisted, so this value governs how much fidelity a finished stroke gives up. Lower values keep a finished stroke closer to the path drawn, at the cost of more points stored per stroke. |