WeaveStrokeNode
Stroke node API Reference
Overview
The WeaveStrokeNode class represents a multi-point continuous line or path on the Weave.js canvas. It is a versatile and essential node type for building tools like freehand drawing.
Built on top of Konva’s Shape class shape under the hood, the WeaveStrokeNode offers full control over the line’s geometry, style, and behavior—all synchronized in real time across users.
The class extends the WeaveNode class
Type
This node nodeType
property value is stroke
.
Import
import { WeaveStrokeNode } from "@inditextech/weave-sdk";
Instantiation
new WeaveStrokeNode(params?: WeaveStrokeNodeParams);
TypeScript types
type WeaveNodeTransformerProperties = Konva.TransformerConfig;
type WeaveStrokeProperties = {
splineResolution: number; // Spline resolution
resamplingSpacing: number; // Spacing for resampling points
transform?: WeaveNodeTransformerProperties;
};
type WeaveStrokeNodeParams = {
config: Partial<WeaveStrokeProperties>;
};
type WeaveStrokePoint = {
x: number;
y: number;
pressure: number;
};
Parameters
For WeaveStrokeNodeParams
:
Prop | Type | Default |
---|---|---|
config | Partial<WeaveStrokeNodeParams> | - |
For WeaveStrokeNodeParams
:
Prop | Type | Default |
---|---|---|
splineResolution? | number | 8 |
Default values
const WEAVE_STROKE_NODE_DEFAULT_CONFIG = {
splineResolution: 8,
resamplingSpacing: 2,
};