PhotoView.d.ts 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. import React from 'react';
  2. import { TapFuncType } from './utils/withContinuousTap';
  3. import { ReachMoveFunction, ReachFunction, PhotoTapFunction, ReachTypeEnum, ShowAnimateEnum, OriginRectType, brokenElementDataType } from './types';
  4. import './PhotoView.less';
  5. export interface IPhotoViewProps {
  6. src: string;
  7. intro?: React.ReactNode;
  8. viewClassName?: string;
  9. className?: string;
  10. style?: object;
  11. loadingElement?: JSX.Element;
  12. brokenElement?: JSX.Element | ((photoProps: brokenElementDataType) => JSX.Element);
  13. rotate: number;
  14. onPhotoTap: PhotoTapFunction;
  15. onMaskTap: PhotoTapFunction;
  16. onReachMove: ReachMoveFunction;
  17. onReachUp: ReachFunction;
  18. onPhotoResize?: () => void;
  19. isActive: boolean;
  20. showAnimateType?: ShowAnimateEnum;
  21. originRect?: OriginRectType;
  22. }
  23. declare const initialState: {
  24. naturalWidth: number;
  25. naturalHeight: number;
  26. width: number;
  27. height: number;
  28. loaded: boolean;
  29. broken: boolean;
  30. x: number;
  31. y: number;
  32. scale: number;
  33. touched: boolean;
  34. maskTouched: boolean;
  35. clientX: number;
  36. clientY: number;
  37. lastX: number;
  38. lastY: number;
  39. lastMoveClientX: number;
  40. lastMoveClientY: number;
  41. touchedTime: number;
  42. lastTouchLength: number;
  43. reachState: ReachTypeEnum;
  44. };
  45. export default class PhotoView extends React.Component<IPhotoViewProps, typeof initialState> {
  46. static displayName: string;
  47. readonly state: {
  48. naturalWidth: number;
  49. naturalHeight: number;
  50. width: number;
  51. height: number;
  52. loaded: boolean;
  53. broken: boolean;
  54. x: number;
  55. y: number;
  56. scale: number;
  57. touched: boolean;
  58. maskTouched: boolean;
  59. clientX: number;
  60. clientY: number;
  61. lastX: number;
  62. lastY: number;
  63. lastMoveClientX: number;
  64. lastMoveClientY: number;
  65. touchedTime: number;
  66. lastTouchLength: number;
  67. reachState: ReachTypeEnum;
  68. };
  69. private initialTouchState;
  70. private readonly handlePhotoTap;
  71. constructor(props: IPhotoViewProps);
  72. componentDidMount(): void;
  73. componentDidUpdate(prevProps: Readonly<IPhotoViewProps>): void;
  74. componentWillUnmount(): void;
  75. handleImageLoad: (imageParams: any) => void;
  76. handleResize: () => void;
  77. handleStart: (clientX: number, clientY: number, touchLength?: number) => void;
  78. onMove: (newClientX: number, newClientY: number, touchLength?: number) => void;
  79. onPhotoTap: (clientX: number, clientY: number) => void;
  80. onDoubleTap: TapFuncType<number>;
  81. handleWheel: (e: any) => void;
  82. handleMaskStart: (clientX: number, clientY: number) => void;
  83. handleMaskMouseDown: (e: any) => void;
  84. handleMaskTouchStart: (e: any) => void;
  85. handleTouchStart: (e: any) => void;
  86. handleMouseDown: (e: any) => void;
  87. handleTouchMove: (e: any) => void;
  88. handleMouseMove: (e: any) => void;
  89. handleUp: (newClientX: number, newClientY: number) => void;
  90. handleTouchEnd: (e: any) => void;
  91. handleMouseUp: (e: any) => void;
  92. render(): JSX.Element;
  93. }
  94. export {};