How Can I make custom edge like default step type? #3190
-
I have very simple Custom Edge. `import { BaseEdge, BezierEdge, getBezierPath } from "reactflow"; function CustomEdge(props) { return ( export default CustomEdge; I want this Custom Edge be like step edge type. I can use |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
React Flow provides a utility called import React from 'react';
import { BaseEdge, EdgeProps, getSmoothStepPath } from 'reactflow';
export default function CustomEdge({
id,
sourceX,
sourceY,
targetX,
targetY,
sourcePosition,
targetPosition,
style = {},
markerEnd,
}: EdgeProps) {
const [edgePath, labelX, labelY] = getSmoothStepPath({
sourceX,
sourceY,
sourcePosition,
targetX,
targetY,
targetPosition,
});
return <BaseEdge path={edgePath} markerEnd={markerEnd} style={style} />
} |
Beta Was this translation helpful? Give feedback.
-
How can I make it into first one |
Beta Was this translation helpful? Give feedback.
React Flow provides a utility called
getSmoothStepPath
, just likegetBezierPath
, that you can use.