fix: improve TSDoc comments for ViewportHelperFunctions and NodeToolbarProps
This commit is contained in:
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'@xyflow/react': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix: improve TSDoc comments for `ViewportHelperFunctions` and `NodeToolbarProps`
|
||||||
@@ -10,12 +10,12 @@ export type NodeToolbarProps = HTMLAttributes<HTMLDivElement> & {
|
|||||||
* of nodes.
|
* of nodes.
|
||||||
*/
|
*/
|
||||||
nodeId?: string | string[];
|
nodeId?: string | string[];
|
||||||
/** If true, node toolbar is visible even if node is not selected */
|
/** If `true`, node toolbar is visible even if node is not selected. */
|
||||||
isVisible?: boolean;
|
isVisible?: boolean;
|
||||||
/**
|
/**
|
||||||
* Position of the toolbar relative to the node
|
* Position of the toolbar relative to the node.
|
||||||
* @example Position.TopLeft, Position.TopRight,
|
* @default Position.Top
|
||||||
* Position.BottomLeft, Position.BottomRight
|
* @example Position.TopLeft, Position.TopRight, Position.BottomLeft, Position.BottomRight
|
||||||
*/
|
*/
|
||||||
position?: Position;
|
position?: Position;
|
||||||
/**
|
/**
|
||||||
@@ -24,7 +24,8 @@ export type NodeToolbarProps = HTMLAttributes<HTMLDivElement> & {
|
|||||||
*/
|
*/
|
||||||
offset?: number;
|
offset?: number;
|
||||||
/**
|
/**
|
||||||
* Align the toolbar relative to the node
|
* Align the toolbar relative to the node.
|
||||||
|
* @default "center"
|
||||||
* @example Align.Start, Align.Center, Align.End
|
* @example Align.Start, Align.Center, Align.End
|
||||||
*/
|
*/
|
||||||
align?: Align;
|
align?: Align;
|
||||||
|
|||||||
@@ -131,14 +131,15 @@ export type ViewportHelperFunctions = {
|
|||||||
*/
|
*/
|
||||||
zoomOut: ZoomInOut;
|
zoomOut: ZoomInOut;
|
||||||
/**
|
/**
|
||||||
* Sets the current zoom level.
|
* Zoom the viewport to a given zoom level. Passing in a `duration` will animate the viewport to
|
||||||
|
* the new zoom level.
|
||||||
*
|
*
|
||||||
* @param zoomLevel - the zoom level to set
|
* @param zoomLevel - the zoom level to set
|
||||||
* @param options.duration - optional duration. If set, a transition will be applied
|
* @param options.duration - optional duration. If set, a transition will be applied
|
||||||
*/
|
*/
|
||||||
zoomTo: ZoomTo;
|
zoomTo: ZoomTo;
|
||||||
/**
|
/**
|
||||||
* Returns the current zoom level.
|
* Get the current zoom level of the viewport.
|
||||||
*
|
*
|
||||||
* @returns current zoom as a number
|
* @returns current zoom as a number
|
||||||
*/
|
*/
|
||||||
@@ -157,7 +158,8 @@ export type ViewportHelperFunctions = {
|
|||||||
*/
|
*/
|
||||||
getViewport: GetViewport;
|
getViewport: GetViewport;
|
||||||
/**
|
/**
|
||||||
* Sets the center of the view to the given position.
|
* Center the viewport on a given position. Passing in a `duration` will animate the viewport to
|
||||||
|
* the new position.
|
||||||
*
|
*
|
||||||
* @param x - x position
|
* @param x - x position
|
||||||
* @param y - y position
|
* @param y - y position
|
||||||
@@ -165,14 +167,17 @@ export type ViewportHelperFunctions = {
|
|||||||
*/
|
*/
|
||||||
setCenter: SetCenter;
|
setCenter: SetCenter;
|
||||||
/**
|
/**
|
||||||
* Fits the view to the given bounds .
|
* A low-level utility function to fit the viewport to a given rectangle. By passing in a
|
||||||
|
* `duration`, the viewport will animate from its current position to the new position. The
|
||||||
|
* `padding` option can be used to add space around the bounds.
|
||||||
*
|
*
|
||||||
* @param bounds - the bounds ({ x: number, y: number, width: number, height: number }) to fit the view to
|
* @param bounds - the bounds ({ x: number, y: number, width: number, height: number }) to fit the view to
|
||||||
* @param options.padding - optional padding
|
* @param options.padding - optional padding
|
||||||
*/
|
*/
|
||||||
fitBounds: FitBounds;
|
fitBounds: FitBounds;
|
||||||
/**
|
/**
|
||||||
* Converts a screen / client position to a flow position.
|
* With this function you can translate a screen pixel position to a flow position. It is useful
|
||||||
|
* for implementing drag and drop from a sidebar for example.
|
||||||
*
|
*
|
||||||
* @param clientPosition - the screen / client position. When you are working with events you can use event.clientX and event.clientY
|
* @param clientPosition - the screen / client position. When you are working with events you can use event.clientX and event.clientY
|
||||||
* @param options.snapToGrid - if true, the converted position will be snapped to the grid
|
* @param options.snapToGrid - if true, the converted position will be snapped to the grid
|
||||||
@@ -183,7 +188,7 @@ export type ViewportHelperFunctions = {
|
|||||||
*/
|
*/
|
||||||
screenToFlowPosition: (clientPosition: XYPosition, options?: { snapToGrid: boolean }) => XYPosition;
|
screenToFlowPosition: (clientPosition: XYPosition, options?: { snapToGrid: boolean }) => XYPosition;
|
||||||
/**
|
/**
|
||||||
* Converts a flow position to a screen / client position.
|
* Translate a position inside the flow's canvas to a screen pixel position.
|
||||||
*
|
*
|
||||||
* @param flowPosition - the screen / client position. When you are working with events you can use event.clientX and event.clientY
|
* @param flowPosition - the screen / client position. When you are working with events you can use event.clientX and event.clientY
|
||||||
* @returns position as { x: number, y: number }
|
* @returns position as { x: number, y: number }
|
||||||
|
|||||||
Reference in New Issue
Block a user