Overview
The WeaveStrokeSingleNode class represents a single stroke line on the Weave.js canvas. It is a versatile and essential node type for building tools like freehand drawing. It supports also define tips for both stroke ends as:
-
Arrow
-
Circle
-
Square
The class extends the WeaveNode class
TypeScript types
type WeaveStrokeSingleProperties = {
transform?: WeaveNodeTransformerProperties;
snapAngles: {
angles: number[]; // Angles for snapping in degrees
activateThreshold: number;
releaseThreshold: number;
};
};
type WeaveStrokeSingleNodeParams = {
config: Partial<WeaveStrokeSingleProperties>;
};
type WeaveStrokeSingleNodeTipSideKeys =
keyof typeof WEAVE_STROKE_SINGLE_NODE_TIP_SIDE;
type WeaveStrokeSingleNodeTipSide =
(typeof WEAVE_STROKE_SINGLE_NODE_TIP_SIDE)[WeaveStrokeSingleNodeTipSideKeys];
Parameters
For WeaveStrokeSingleNodeParams:
| Property | Type | Required | Description |
|---|---|---|---|
|
|
Required |
Config parameters for the node. |
For WeaveStrokeSingleProperties:
| 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. |
|
|
|
|
Setup the transform properties for the line (if can be resized, rotated, anchors, etc.). |