Skip to main content

drawEdge

Function that converts a point sequence into an SVG path d attribute string.

TypeSVGDrawFunction
DefaultsvgDrawSmoothLinePath (bezier preset)

Built-in functions

ExportUsed by
svgDrawSmoothLinePathSmartBezierEdge
svgDrawStraightLinePathSmartStraightEdge, SmartStepEdge
svgDrawSmoothStepLinePath({ borderRadius })SmartSmoothStepEdge (factory)
svgDrawSimpleBezierLinePathSmartSimpleBezierEdge
import {
createSmartEdge,
svgDrawSmoothStepLinePath,
} from "@tisoap/react-flow-smart-edge";

const edgeTypes = {
smartSmoothStep: createSmartEdge("smoothstep", {
drawEdge: svgDrawSmoothStepLinePath({ borderRadius: 12 }),
}),
};

Signature

type SVGDrawFunction = (
source: XYPosition,
target: XYPosition,
path: number[][],
) => string;

For simple-bezier drawing, use the separate SVGSimpleBezierDrawFunction type (requires handle position on endpoints). Pass either type to getSmartEdge / createSmartEdge via DrawEdgeFunction.

See drawSvgPath.ts source for implementation examples.