Overview
The WeaveStrokeToolAction class that allows users to draw a precise, vector-based line by click-and-drag to define the line.
The line becomes a WeaveStrokeSingleNode, synced in real time across all collaborators.
The class extends the WeaveAction class.
TypeScript types
type WeaveStrokeToolActionStateKeys = keyof typeof WEAVE_STROKE_TOOL_STATE;
type WeaveStrokeToolActionState =
(typeof WEAVE_STROKE_TOOL_STATE)[WeaveStrokeToolActionStateKeys];
type WeaveStrokeToolActionProperties = {
snapAngles: {
angles: number[]; // Angles for snapping in degrees
activateThreshold: number;
releaseThreshold: number;
};
};
type WeaveStrokeToolActionParams = {
config: Partial<WeaveStrokeToolActionProperties>;
};
type WeaveStrokeToolActionOnAddingEvent = { actionName: string };
type WeaveStrokeToolActionOnAddedEvent = { actionName: string };
Parameters
For WeaveStrokeToolActionParams:
| Property | Type | Required | Description |
|---|---|---|---|
|
|
Required |
Config parameters for the tool. |
For WeaveStrokeToolActionProperties:
| Property | Type | Required | Default | Description |
|---|---|---|---|---|
|
|
|
Array of angles (in degrees) to snap the line to when shift is pressed. |
|
|
|
|
Activation threshold for the angle snapping utility. |
|
|
|
|
Release threshold for the angle snapping utility. |