getSmoothStepPath()
The getSmoothStepPath util returns the SVG path string for a smooth-step edge,
along with the label coordinates. Set borderRadius to 0 for a sharp step edge.
import { BaseEdge, getSmoothStepPath } from '@xyflow/vue';
const [path, labelX, labelY] = getSmoothStepPath({
sourceX, sourceY, sourcePosition,
targetX, targetY, targetPosition,
});Signature
Parameters:| Name | Type | Default |
|---|---|---|
sourceX | numberThe | |
sourceY | numberThe | |
sourcePosition | PositionThe position of the source handle. | Position.Bottom |
targetX | numberThe | |
targetY | numberThe | |
targetPosition | PositionThe position of the target handle. | Position.Top |
borderRadius | number | 5 |
centerX | number | |
centerY | number | |
offset | number | 20 |
stepPosition | numberControls where the bend occurs along the path. 0 = at source, 1 = at target, 0.5 = midpoint | 0.5 |
[path: string, labelX: number, labelY: number, offsetX: number, offsetY: number]A path string you can use in an SVG, the labelX and labelY position (center of path)
and offsetX, offsetY between source handle and label.
path: the path to use in an SVG<path>element.labelX: thexposition you can use to render a label for this edge.labelY: theyposition you can use to render a label for this edge.offsetX: the absolute difference between the sourcexposition and thexposition of the middle of this path.offsetY: the absolute difference between the sourceyposition and theyposition of the middle of this path.