pdf.ts 1.4 KB

12345678910111213141516171819202122232425262728
  1. import * as types from '../constants/actionTypes';
  2. const actions: ActionType = dispatch => ({
  3. setTotalPage: (page: number): void =>
  4. dispatch({ type: types.SET_TOTAL_PAGE, payload: page }),
  5. setCurrentPage: (page: number): void =>
  6. dispatch({ type: types.SET_CURRENT_PAGE, payload: page }),
  7. setPdf: (pdf: Record<string, any>): void =>
  8. dispatch({ type: types.SET_PDF, payload: pdf }),
  9. setProgress: (progress: ProgressType): void =>
  10. dispatch({ type: types.SET_PROGRESS, payload: progress }),
  11. setViewport: (viewport: ViewportType): void =>
  12. dispatch({ type: types.SET_VIEWPORT, payload: viewport }),
  13. changeScale: (scale: number | string): void =>
  14. dispatch({ type: types.CHANGE_SCALE, payload: scale }),
  15. changeRotate: (rotation: number): void =>
  16. dispatch({ type: types.CHANGE_ROTATE, payload: rotation }),
  17. addAnnots: (annotations: AnnotationType[], init = true): void =>
  18. dispatch({ type: types.ADD_ANNOTS, payload: { annotations, init } }),
  19. updateAnnots: (annotations: AnnotationType[]): void =>
  20. dispatch({ type: types.UPDATE_ANNOTS, payload: annotations }),
  21. updateWatermark: (watermark: WatermarkType): void =>
  22. dispatch({ type: types.UPDATE_WATERMARK, payload: watermark }),
  23. setTextDivs: (pageNum: number, elements: HTMLElement[]): void =>
  24. dispatch({ type: types.SET_TEXT_DIV, payload: { [pageNum]: elements } }),
  25. });
  26. export default actions;