Skip to Content
Vue Flow v2 is here and joins xyflow! Read more here →
ReferenceUtils

getSmoothStepPath()

Source on GitHub 

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:
NameTypeDefault
sourceXnumber

The x position of the source handle.

sourceYnumber

The y position of the source handle.

sourcePositionPosition

The position of the source handle.

Position.Bottom
targetXnumber

The x position of the target handle.

targetYnumber

The y position of the target handle.

targetPositionPosition

The position of the target handle.

Position.Top
borderRadiusnumber5
centerXnumber
centerYnumber
offsetnumber20
stepPositionnumber

Controls where the bend occurs along the path. 0 = at source, 1 = at target, 0.5 = midpoint

0.5
Returns:
[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: the x position you can use to render a label for this edge.
  • labelY: the y position you can use to render a label for this edge.
  • offsetX: the absolute difference between the source x position and the x position of the middle of this path.
  • offsetY: the absolute difference between the source y position and the y position of the middle of this path.