pdf.ts 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. export const setCurrentPage: ReducerFuncType = (state, { payload }) => ({
  2. ...state,
  3. currentPage: payload,
  4. });
  5. export const setTotalPage: ReducerFuncType = (state, { payload }) => ({
  6. ...state,
  7. totalPage: payload,
  8. });
  9. export const setPdf: ReducerFuncType = (state, { payload }) => ({
  10. ...state,
  11. pdf: payload,
  12. });
  13. export const setProgress: ReducerFuncType = (state, { payload }) => ({
  14. ...state,
  15. progress: payload,
  16. });
  17. export const setViewport: ReducerFuncType = (state, { payload }) => ({
  18. ...state,
  19. viewport: payload,
  20. });
  21. export const changeScale: ReducerFuncType = (state, { payload }) => ({
  22. ...state,
  23. scale: payload,
  24. });
  25. export const changeRotate: ReducerFuncType = (state, { payload }) => ({
  26. ...state,
  27. rotation: payload,
  28. });
  29. export const addAnnotation: ReducerFuncType = (state, { payload }) => ({
  30. ...state,
  31. annotations: [...state.annotations, ...payload.annotations],
  32. initiated: payload.init,
  33. });
  34. export const updateAnnotation: ReducerFuncType = (state, { payload }) => ({
  35. ...state,
  36. annotations: [...payload],
  37. initiated: true,
  38. });
  39. export const updateWatermark: ReducerFuncType = (state, { payload }) => ({
  40. ...state,
  41. watermark: {
  42. ...state.watermark,
  43. ...payload,
  44. },
  45. });