chore(system): add comments for types

This commit is contained in:
moklick
2025-06-16 09:55:50 +02:00
parent 3d7e8b6bb1
commit 85efdd8876
+31
View File
@@ -21,8 +21,33 @@ export type ZoomInOut = (options?: ViewportHelperFunctionOptions) => Promise<boo
export type ZoomTo = (zoomLevel: number, options?: ViewportHelperFunctionOptions) => Promise<boolean>;
export type GetZoom = () => number;
export type GetViewport = () => Viewport;
/**
* The `SetViewport` function is used to set the viewport of the flow.
*
* @inline
* @param viewport - The viewport to set.
* @param options - Optional parameters to control the animation and easing of the viewport change.
*/
export type SetViewport = (viewport: Viewport, options?: ViewportHelperFunctionOptions) => Promise<boolean>;
/**
* The `SetCenter` function is used to set the center of the flow viewport to a specific position
*
* @inline
* @param x - x coordinate
* @param y - y coordinate
* @param options - Optional parameters to control the animation and easing of the viewport change.
*/
export type SetCenter = (x: number, y: number, options?: SetCenterOptions) => Promise<boolean>;
/**
* The `FitBounds` function is used to fit the flow viewport to the bounds of the nodes.
*
* @inline
* @param bounds - The bounds to fit the viewport to.
* @param options - Optional parameters to control the animation and easing of the viewport change.
*/
export type FitBounds = (bounds: Rect, options?: FitBoundsOptions) => Promise<boolean>;
/**
@@ -179,10 +204,16 @@ export type ViewportHelperFunctionOptions = {
interpolate?: 'smooth' | 'linear';
};
/**
* @inline
*/
export type SetCenterOptions = ViewportHelperFunctionOptions & {
zoom?: number;
};
/**
* @inline
*/
export type FitBoundsOptions = ViewportHelperFunctionOptions & {
padding?: number;
};