Merge pull request #5164 from dimaMachina/tsdoc2-10

Improve TSDoc comments for `type UseOnViewportChangeOptions` and `useOnViewportChange` hook
This commit is contained in:
Moritz Klack
2025-04-06 21:01:46 +02:00
committed by GitHub
2 changed files with 10 additions and 6 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@xyflow/react': patch
---
Improve TSDoc comments for `type UseOnViewportChangeOptions` and `useOnViewportChange` hook
@@ -4,21 +4,20 @@ import type { OnViewportChange } from '@xyflow/system';
import { useStoreApi } from './useStore';
export type UseOnViewportChangeOptions = {
/** Gets called when the viewport starts changing. */
onStart?: OnViewportChange;
/** Gets called when the viewport changes. */
onChange?: OnViewportChange;
/** Gets called when the viewport stops changing. */
onEnd?: OnViewportChange;
};
/**
* The `useOnViewportChange` hook lets you listen for changes to the viewport such
*as panning and zooming. You can provide a callback for each phase of a viewport
*change: `onStart`, `onChange`, and `onEnd`.
* as panning and zooming. You can provide a callback for each phase of a viewport
* change: `onStart`, `onChange`, and `onEnd`.
*
* @public
* @param params.onStart - gets called when the viewport starts changing
* @param params.onChange - gets called when the viewport changes
* @param params.onEnd - gets called when the viewport stops changing
*
* @example
* ```jsx
*import { useCallback } from 'react';