import React from "react"; import { TransformContext } from "../components/transform-context"; import { animations } from "../core/animations/animations.constants"; import { centerView, resetTransform, setTransform, zoomIn, zoomOut, zoomToElement } from "../core/handlers/handlers.logic"; import { DeepNonNullable } from "./helpers.model"; export type ReactZoomPanPinchContext = typeof TransformContext.prototype; export type ReactZoomPanPinchRef = { instance: ReactZoomPanPinchContext; state: ReactZoomPanPinchState; } & ReactZoomPanPinchHandlers; export interface ReactZoomPanPinchState { previousScale: number; scale: number; positionX: number; positionY: number; } export interface ReactZoomPanPinchHandlers { zoomIn: ReturnType; zoomOut: ReturnType; setTransform: ReturnType; resetTransform: ReturnType; centerView: ReturnType; zoomToElement: ReturnType; } export interface ReactZoomPanPinchProps { children?: React.ReactNode | ((ref: ReactZoomPanPinchRef) => React.ReactNode); ref?: React.Ref; initialScale?: number; initialPositionX?: number; initialPositionY?: number; disabled?: boolean; minPositionX?: null | number; maxPositionX?: null | number; minPositionY?: null | number; maxPositionY?: null | number; minScale?: number; maxScale?: number; limitToBounds?: boolean; centerZoomedOut?: boolean; centerOnInit?: boolean; wheel?: { step?: number; disabled?: boolean; wheelDisabled?: boolean; touchPadDisabled?: boolean; activationKeys?: Array; excluded?: Array; }; panning?: { disabled?: boolean; velocityDisabled?: boolean; lockAxisX?: boolean; lockAxisY?: boolean; activationKeys?: Array; excluded?: Array; }; pinch?: { step?: number; disabled?: boolean; excluded?: Array; }; doubleClick?: { disabled?: boolean; step?: number; mode?: "zoomIn" | "zoomOut" | "reset"; animationTime?: number; animationType?: keyof typeof animations; excluded?: Array; }; zoomAnimation?: { disabled?: boolean; size?: number; animationTime?: number; animationType?: keyof typeof animations; }; alignmentAnimation?: { disabled?: boolean; sizeX?: number; sizeY?: number; animationTime?: number; velocityAlignmentTime?: number; animationType?: keyof typeof animations; }; velocityAnimation?: { disabled?: boolean; sensitivity?: number; animationTime?: number; animationType?: keyof typeof animations; equalToMove?: boolean; }; onWheelStart?: (ref: ReactZoomPanPinchRef, event: WheelEvent) => void; onWheel?: (ref: ReactZoomPanPinchRef, event: WheelEvent) => void; onWheelStop?: (ref: ReactZoomPanPinchRef, event: WheelEvent) => void; onPanningStart?: (ref: ReactZoomPanPinchRef, event: TouchEvent | MouseEvent) => void; onPanning?: (ref: ReactZoomPanPinchRef, event: TouchEvent | MouseEvent) => void; onPanningStop?: (ref: ReactZoomPanPinchRef, event: TouchEvent | MouseEvent) => void; onPinchingStart?: (ref: ReactZoomPanPinchRef, event: TouchEvent) => void; onPinching?: (ref: ReactZoomPanPinchRef, event: TouchEvent) => void; onPinchingStop?: (ref: ReactZoomPanPinchRef, event: TouchEvent) => void; onZoomStart?: (ref: ReactZoomPanPinchRef, event: TouchEvent | MouseEvent) => void; onZoom?: (ref: ReactZoomPanPinchRef, event: TouchEvent | MouseEvent) => void; onZoomStop?: (ref: ReactZoomPanPinchRef, event: TouchEvent | MouseEvent) => void; onInit?: (ref: ReactZoomPanPinchRef) => void; } export interface ReactZoomPanPinchComponentHelpers { setComponents: (wrapper: HTMLDivElement, content: HTMLDivElement) => void; } export type LibrarySetup = Pick & DeepNonNullable>;