pdf.ts 1.2 KB

1234567891011121314151617181920212223242526272829303132
  1. import * as types from '../constants/actionTypes';
  2. import { ProgressType, ViewportType, AnnotationType } from '../constants/type';
  3. export default (dispatch: any): any => ({
  4. setTotalPage: (page: number): any => (
  5. dispatch({ type: types.SET_TOTAL_PAGE, payload: page })
  6. ),
  7. setCurrentPage: (page: number): any => (
  8. dispatch({ type: types.SET_CURRENT_PAGE, payload: page })
  9. ),
  10. setPdf: (pdf: Record<string, any>): any => (
  11. dispatch({ type: types.SET_PDF, payload: pdf })
  12. ),
  13. setProgress: (progress: ProgressType): any => (
  14. dispatch({ type: types.SET_PROGRESS, payload: progress })
  15. ),
  16. setViewport: (viewport: ViewportType): any => (
  17. dispatch({ type: types.SET_VIEWPORT, payload: viewport })
  18. ),
  19. changeScale: (scale: number | string): any => (
  20. dispatch({ type: types.CHANGE_SCALE, payload: scale })
  21. ),
  22. changeRotate: (rotation: number): any => (
  23. dispatch({ type: types.CHANGE_ROTATE, payload: rotation })
  24. ),
  25. addAnnotation: (annotations: AnnotationType[], init: boolean): any => (
  26. dispatch({ type: types.ADD_ANNOTATIONS, payload: { annotations, init } })
  27. ),
  28. updateAnnotation: (annotations: AnnotationType[]): any => (
  29. dispatch({ type: types.UPDATE_ANNOTATIONS, payload: annotations })
  30. ),
  31. });