@supunlakmal/hooks
Version:
A collection of reusable React hooks
24 lines (23 loc) • 766 B
TypeScript
interface PinchZoomState {
scale: number;
delta: number;
origin: {
x: number;
y: number;
};
}
interface PinchZoomOptions {
onPinchStart?: (state: PinchZoomState, event: TouchEvent) => void;
onPinchMove?: (state: PinchZoomState, event: TouchEvent) => void;
onPinchEnd?: (state: PinchZoomState, event: TouchEvent) => void;
minScale?: number;
maxScale?: number;
}
/**
* Hook to detect pinch-to-zoom gestures on a target element.
*
* @param {React.RefObject<HTMLElement>} targetRef Ref to the target HTML element.
* @param {PinchZoomOptions} options Configuration options and callbacks.
*/
export declare function usePinchZoom(targetRef: React.RefObject<HTMLElement>, options: PinchZoomOptions): void;
export {};