Merge pull request #5157 from dimaMachina/tsdoc2-3
Improve TSDoc comments for `type GetBezierPathParams` and `getBezierPath` function
This commit is contained in:
5
.changeset/rich-mirrors-exist.md
Normal file
5
.changeset/rich-mirrors-exist.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@xyflow/system': patch
|
||||
---
|
||||
|
||||
Improve TSDoc comments for `type GetBezierPathParams` and `getBezierPath` function
|
||||
@@ -1,12 +1,28 @@
|
||||
import { Position } from '../../types';
|
||||
|
||||
export type GetBezierPathParams = {
|
||||
/** The `x` position of the source handle. */
|
||||
sourceX: number;
|
||||
/** The `y` position of the source handle. */
|
||||
sourceY: number;
|
||||
/**
|
||||
* The position of the source handle.
|
||||
* @default Position.Bottom
|
||||
*/
|
||||
sourcePosition?: Position;
|
||||
/** The `x` position of the target handle. */
|
||||
targetX: number;
|
||||
/** The `y` position of the target handle. */
|
||||
targetY: number;
|
||||
/**
|
||||
* The position of the target handle.
|
||||
* @default Position.Top
|
||||
*/
|
||||
targetPosition?: Position;
|
||||
/**
|
||||
* The curvature of the bezier edge.
|
||||
* @default 0.25
|
||||
*/
|
||||
curvature?: number;
|
||||
};
|
||||
|
||||
@@ -75,14 +91,15 @@ function getControlWithCurvature({ pos, x1, y1, x2, y2, c }: GetControlWithCurva
|
||||
* The `getBezierPath` util returns everything you need to render a bezier edge
|
||||
*between two nodes.
|
||||
* @public
|
||||
* @param params.sourceX - The x position of the source handle
|
||||
* @param params.sourceY - The y position of the source handle
|
||||
* @param params.sourcePosition - The position of the source handle (default: Position.Bottom)
|
||||
* @param params.targetX - The x position of the target handle
|
||||
* @param params.targetY - The y position of the target handle
|
||||
* @param params.targetPosition - The position of the target handle (default: Position.Top)
|
||||
* @param params.curvature - The curvature of the bezier edge
|
||||
* @returns 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
|
||||
* @returns 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.
|
||||
* @example
|
||||
* ```js
|
||||
* const source = { x: 0, y: 20 };
|
||||
|
||||
Reference in New Issue
Block a user