@embedpdf/plugin-annotation 1.4.1 → 2.0.0-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.js +1760 -1444
  4. package/dist/index.js.map +1 -1
  5. package/dist/lib/actions.d.ts +58 -19
  6. package/dist/lib/annotation-plugin.d.ts +14 -5
  7. package/dist/lib/index.d.ts +1 -1
  8. package/dist/lib/reducer.d.ts +2 -1
  9. package/dist/lib/selectors.d.ts +10 -8
  10. package/dist/lib/types.d.ts +53 -10
  11. package/dist/preact/index.cjs +1 -1
  12. package/dist/preact/index.cjs.map +1 -1
  13. package/dist/preact/index.js +96 -48
  14. package/dist/preact/index.js.map +1 -1
  15. package/dist/react/index.cjs +1 -1
  16. package/dist/react/index.cjs.map +1 -1
  17. package/dist/react/index.js +96 -48
  18. package/dist/react/index.js.map +1 -1
  19. package/dist/shared/components/annotation-container.d.ts +4 -3
  20. package/dist/shared/components/annotation-layer.d.ts +7 -7
  21. package/dist/shared/components/annotation-paint-layer.d.ts +2 -1
  22. package/dist/shared/components/annotations/stamp.d.ts +2 -1
  23. package/dist/shared/components/annotations.d.ts +3 -2
  24. package/dist/shared/components/render-annotation.d.ts +2 -1
  25. package/dist/shared/components/text-markup.d.ts +2 -1
  26. package/dist/shared/components/types.d.ts +7 -7
  27. package/dist/shared/hooks/use-annotation.d.ts +8 -4
  28. package/dist/shared/index.d.ts +1 -0
  29. package/dist/shared-preact/components/annotation-container.d.ts +4 -3
  30. package/dist/shared-preact/components/annotation-layer.d.ts +7 -7
  31. package/dist/shared-preact/components/annotation-paint-layer.d.ts +2 -1
  32. package/dist/shared-preact/components/annotations/stamp.d.ts +2 -1
  33. package/dist/shared-preact/components/annotations.d.ts +3 -2
  34. package/dist/shared-preact/components/render-annotation.d.ts +2 -1
  35. package/dist/shared-preact/components/text-markup.d.ts +2 -1
  36. package/dist/shared-preact/components/types.d.ts +7 -7
  37. package/dist/shared-preact/hooks/use-annotation.d.ts +8 -4
  38. package/dist/shared-preact/index.d.ts +1 -0
  39. package/dist/shared-react/components/annotation-container.d.ts +4 -3
  40. package/dist/shared-react/components/annotation-layer.d.ts +7 -7
  41. package/dist/shared-react/components/annotation-paint-layer.d.ts +2 -1
  42. package/dist/shared-react/components/annotations/stamp.d.ts +2 -1
  43. package/dist/shared-react/components/annotations.d.ts +3 -2
  44. package/dist/shared-react/components/render-annotation.d.ts +2 -1
  45. package/dist/shared-react/components/text-markup.d.ts +2 -1
  46. package/dist/shared-react/components/types.d.ts +7 -7
  47. package/dist/shared-react/hooks/use-annotation.d.ts +8 -4
  48. package/dist/shared-react/index.d.ts +1 -0
  49. package/dist/svelte/components/AnnotationContainer.svelte.d.ts +26 -0
  50. package/dist/svelte/components/AnnotationLayer.svelte.d.ts +27 -0
  51. package/dist/svelte/components/AnnotationPaintLayer.svelte.d.ts +8 -0
  52. package/dist/svelte/components/Annotations.svelte.d.ts +22 -0
  53. package/dist/svelte/components/PreviewRenderer.svelte.d.ts +8 -0
  54. package/dist/svelte/components/RenderAnnotation.svelte.d.ts +13 -0
  55. package/dist/svelte/components/TextMarkup.svelte.d.ts +8 -0
  56. package/dist/svelte/components/annotations/Circle.svelte.d.ts +26 -0
  57. package/dist/svelte/components/annotations/FreeText.svelte.d.ts +15 -0
  58. package/dist/svelte/components/annotations/Ink.svelte.d.ts +14 -0
  59. package/dist/svelte/components/annotations/Line.svelte.d.ts +18 -0
  60. package/dist/svelte/components/annotations/Polygon.svelte.d.ts +19 -0
  61. package/dist/svelte/components/annotations/Polyline.svelte.d.ts +17 -0
  62. package/dist/svelte/components/annotations/Square.svelte.d.ts +16 -0
  63. package/dist/svelte/components/annotations/Stamp.svelte.d.ts +13 -0
  64. package/dist/svelte/components/annotations/index.d.ts +8 -0
  65. package/dist/svelte/components/index.d.ts +9 -0
  66. package/dist/svelte/components/text-markup/Highlight.svelte.d.ts +13 -0
  67. package/dist/svelte/components/text-markup/Squiggly.svelte.d.ts +13 -0
  68. package/dist/svelte/components/text-markup/Strikeout.svelte.d.ts +13 -0
  69. package/dist/svelte/components/text-markup/Underline.svelte.d.ts +13 -0
  70. package/dist/svelte/components/text-markup/index.d.ts +4 -0
  71. package/dist/svelte/components/types.d.ts +32 -0
  72. package/dist/svelte/hooks/index.d.ts +1 -0
  73. package/dist/svelte/hooks/use-annotation.svelte.d.ts +21 -0
  74. package/dist/svelte/index.cjs +2 -0
  75. package/dist/svelte/index.cjs.map +1 -0
  76. package/dist/svelte/index.d.ts +4 -0
  77. package/dist/svelte/index.js +3083 -0
  78. package/dist/svelte/index.js.map +1 -0
  79. package/dist/svelte/types.d.ts +54 -0
  80. package/dist/vue/components/annotation-container.vue.d.ts +10 -5
  81. package/dist/vue/components/annotation-layer.vue.d.ts +13 -7
  82. package/dist/vue/components/annotation-paint-layer.vue.d.ts +3 -1
  83. package/dist/vue/components/annotations/circle.vue.d.ts +2 -1
  84. package/dist/vue/components/annotations/free-text.vue.d.ts +2 -1
  85. package/dist/vue/components/annotations/ink.vue.d.ts +2 -1
  86. package/dist/vue/components/annotations/line.vue.d.ts +2 -1
  87. package/dist/vue/components/annotations/polygon.vue.d.ts +2 -1
  88. package/dist/vue/components/annotations/polyline.vue.d.ts +2 -1
  89. package/dist/vue/components/annotations/square.vue.d.ts +2 -1
  90. package/dist/vue/components/annotations/stamp.vue.d.ts +3 -1
  91. package/dist/vue/components/annotations.vue.d.ts +7 -3
  92. package/dist/vue/components/preview-renderer.vue.d.ts +2 -1
  93. package/dist/vue/components/render-annotation.vue.d.ts +3 -1
  94. package/dist/vue/components/text-markup/highlight.vue.d.ts +2 -1
  95. package/dist/vue/components/text-markup/squiggly.vue.d.ts +2 -1
  96. package/dist/vue/components/text-markup/strikeout.vue.d.ts +2 -1
  97. package/dist/vue/components/text-markup/underline.vue.d.ts +2 -1
  98. package/dist/vue/components/text-markup.vue.d.ts +3 -1
  99. package/dist/vue/hooks/use-annotation.d.ts +21 -2682
  100. package/dist/vue/index.cjs +1 -1
  101. package/dist/vue/index.cjs.map +1 -1
  102. package/dist/vue/index.d.ts +1 -0
  103. package/dist/vue/index.js +354 -250
  104. package/dist/vue/index.js.map +1 -1
  105. package/dist/vue/types.d.ts +23 -0
  106. package/package.json +20 -12
@@ -1,9 +1,9 @@
1
- import { usePlugin, useCapability } from "@embedpdf/core/react";
2
- import { AnnotationPlugin, initialState, patching, getAnnotationsByPageIndex, getSelectedAnnotationByPageIndex, isInk, isSquare, isCircle, isUnderline, isStrikeout, isSquiggly, isHighlight, isLine, isPolyline, isPolygon, isFreeText, isStamp } from "@embedpdf/plugin-annotation";
1
+ import { usePlugin, useCapability, useDocumentState } from "@embedpdf/core/react";
2
+ import { AnnotationPlugin, initialDocumentState, patching, getAnnotationsByPageIndex, getSelectedAnnotationByPageIndex, isInk, isSquare, isCircle, isUnderline, isStrikeout, isSquiggly, isHighlight, isLine, isPolyline, isPolygon, isFreeText, isStamp } from "@embedpdf/plugin-annotation";
3
3
  export * from "@embedpdf/plugin-annotation";
4
4
  import { useState, useEffect, useRef, useMemo, useLayoutEffect, Fragment as Fragment$1, useCallback } from "react";
5
5
  import { jsxs, jsx, Fragment } from "react/jsx-runtime";
6
- import { PdfAnnotationBorderStyle, textAlignmentToCss, standardFontCss, PdfVerticalAlignment, ignore, PdfErrorCode, blendModeToCss, PdfBlendMode, PdfAnnotationSubtype } from "@embedpdf/models";
6
+ import { PdfAnnotationBorderStyle, textAlignmentToCss, standardFontCss, PdfVerticalAlignment, ignore, PdfErrorCode, blendModeToCss, PdfBlendMode, PdfAnnotationSubtype, Rotation } from "@embedpdf/models";
7
7
  import { usePointerHandlers } from "@embedpdf/plugin-interaction-manager/react";
8
8
  import { useSelectionCapability } from "@embedpdf/plugin-selection/react";
9
9
  import { useInteractionHandles, useDoublePressProps, CounterRotate } from "@embedpdf/utils/react";
@@ -12,21 +12,28 @@ const suppressContentEditableWarningProps = {
12
12
  };
13
13
  const useAnnotationPlugin = () => usePlugin(AnnotationPlugin.id);
14
14
  const useAnnotationCapability = () => useCapability(AnnotationPlugin.id);
15
- const useAnnotation = () => {
15
+ const useAnnotation = (documentId) => {
16
+ var _a;
16
17
  const { provides } = useAnnotationCapability();
17
- const [state, setState] = useState(initialState({ enabled: true }));
18
+ const [state, setState] = useState(
19
+ ((_a = provides == null ? void 0 : provides.forDocument(documentId)) == null ? void 0 : _a.getState()) ?? initialDocumentState()
20
+ );
18
21
  useEffect(() => {
19
- return provides == null ? void 0 : provides.onStateChange((action) => {
20
- setState(action);
22
+ if (!provides) return;
23
+ const scope = provides.forDocument(documentId);
24
+ setState(scope.getState());
25
+ return scope.onStateChange((newState) => {
26
+ setState(newState);
21
27
  });
22
- }, [provides]);
28
+ }, [provides, documentId]);
23
29
  return {
24
30
  state,
25
- provides
31
+ provides: (provides == null ? void 0 : provides.forDocument(documentId)) ?? null
26
32
  };
27
33
  };
28
34
  function AnnotationContainer({
29
35
  scale,
36
+ documentId,
30
37
  pageIndex,
31
38
  rotation,
32
39
  pageWidth,
@@ -51,8 +58,12 @@ function AnnotationContainer({
51
58
  ...props
52
59
  }) {
53
60
  const [preview, setPreview] = useState(trackedAnnotation.object);
54
- const { provides: annotationProvides } = useAnnotationCapability();
61
+ const { provides: annotationCapability } = useAnnotationCapability();
55
62
  const gestureBaseRef = useRef(null);
63
+ const annotationProvides = useMemo(
64
+ () => annotationCapability ? annotationCapability.forDocument(documentId) : null,
65
+ [annotationCapability, documentId]
66
+ );
56
67
  const currentObject = preview ? { ...trackedAnnotation.object, ...preview } : trackedAnnotation.object;
57
68
  const HANDLE_COLOR = (resizeUI == null ? void 0 : resizeUI.color) ?? "#007ACC";
58
69
  const VERTEX_COLOR = (vertexUI == null ? void 0 : vertexUI.color) ?? "#007ACC";
@@ -65,7 +76,7 @@ function AnnotationContainer({
65
76
  constraints: {
66
77
  minWidth: 10,
67
78
  minHeight: 10,
68
- boundingBox: { width: pageWidth / scale, height: pageHeight / scale }
79
+ boundingBox: { width: pageWidth, height: pageHeight }
69
80
  },
70
81
  maintainAspectRatio: lockAspectRatio,
71
82
  pageRotation: rotation,
@@ -80,7 +91,7 @@ function AnnotationContainer({
80
91
  const transformType = event.transformData.type;
81
92
  const base = gestureBaseRef.current ?? currentObject;
82
93
  const changes = event.transformData.changes.vertices ? vertexConfig == null ? void 0 : vertexConfig.transformAnnotation(base, event.transformData.changes.vertices) : { rect: event.transformData.changes.rect };
83
- const patched = annotationProvides == null ? void 0 : annotationProvides.transformAnnotation(base, {
94
+ const patched = annotationCapability == null ? void 0 : annotationCapability.transformAnnotation(base, {
84
95
  type: transformType,
85
96
  changes,
86
97
  metadata: event.transformData.metadata
@@ -185,7 +196,7 @@ function AnnotationContainer({
185
196
  ]
186
197
  }
187
198
  ),
188
- /* @__PURE__ */ jsx(
199
+ selectionMenu && /* @__PURE__ */ jsx(
189
200
  CounterRotate,
190
201
  {
191
202
  rect: {
@@ -199,11 +210,17 @@ function AnnotationContainer({
199
210
  }
200
211
  },
201
212
  rotation,
202
- children: ({ rect, menuWrapperProps }) => selectionMenu && selectionMenu({
203
- annotation: trackedAnnotation,
213
+ children: (props2) => selectionMenu({
214
+ ...props2,
215
+ context: {
216
+ type: "annotation",
217
+ annotation: trackedAnnotation,
218
+ pageIndex
219
+ },
204
220
  selected: isSelected,
205
- rect,
206
- menuWrapperProps
221
+ placement: {
222
+ suggestTop: false
223
+ }
207
224
  })
208
225
  }
209
226
  )
@@ -993,6 +1010,7 @@ function FreeText({
993
1010
  );
994
1011
  }
995
1012
  function RenderAnnotation({
1013
+ documentId,
996
1014
  pageIndex,
997
1015
  annotation,
998
1016
  scaleFactor = 1,
@@ -1005,7 +1023,7 @@ function RenderAnnotation({
1005
1023
  const { width, height } = annotation.rect.size;
1006
1024
  useEffect(() => {
1007
1025
  if (annotationProvides) {
1008
- const task = annotationProvides.renderAnnotation({
1026
+ const task = annotationProvides.forDocument(documentId).renderAnnotation({
1009
1027
  pageIndex,
1010
1028
  annotation,
1011
1029
  options: {
@@ -1030,7 +1048,7 @@ function RenderAnnotation({
1030
1048
  }
1031
1049
  };
1032
1050
  }
1033
- }, [pageIndex, scaleFactor, annotationProvides, annotation.id, width, height]);
1051
+ }, [pageIndex, scaleFactor, annotationProvides, documentId, annotation.id, width, height]);
1034
1052
  const handleImageLoad = () => {
1035
1053
  if (urlRef.current) {
1036
1054
  URL.revokeObjectURL(urlRef.current);
@@ -1052,7 +1070,14 @@ function RenderAnnotation({
1052
1070
  }
1053
1071
  ) });
1054
1072
  }
1055
- function Stamp({ isSelected, annotation, pageIndex, scale, onClick }) {
1073
+ function Stamp({
1074
+ isSelected,
1075
+ annotation,
1076
+ documentId,
1077
+ pageIndex,
1078
+ scale,
1079
+ onClick
1080
+ }) {
1056
1081
  return /* @__PURE__ */ jsx(
1057
1082
  "div",
1058
1083
  {
@@ -1069,6 +1094,7 @@ function Stamp({ isSelected, annotation, pageIndex, scale, onClick }) {
1069
1094
  children: /* @__PURE__ */ jsx(
1070
1095
  RenderAnnotation,
1071
1096
  {
1097
+ documentId,
1072
1098
  pageIndex,
1073
1099
  annotation: { ...annotation.object, id: annotation.object.id },
1074
1100
  scaleFactor: scale
@@ -1078,21 +1104,28 @@ function Stamp({ isSelected, annotation, pageIndex, scale, onClick }) {
1078
1104
  );
1079
1105
  }
1080
1106
  function Annotations(annotationsProps) {
1081
- const { pageIndex, scale, selectionMenu } = annotationsProps;
1082
- const { provides: annotationProvides } = useAnnotationCapability();
1107
+ const { documentId, pageIndex, scale, selectionMenu } = annotationsProps;
1108
+ const { provides: annotationCapability } = useAnnotationCapability();
1083
1109
  const { provides: selectionProvides } = useSelectionCapability();
1084
1110
  const [annotations, setAnnotations] = useState([]);
1085
- const { register } = usePointerHandlers({ pageIndex });
1111
+ const { register } = usePointerHandlers({ documentId, pageIndex });
1086
1112
  const [selectionState, setSelectionState] = useState(null);
1087
1113
  const [editingId, setEditingId] = useState(null);
1114
+ const annotationProvides = useMemo(
1115
+ () => annotationCapability ? annotationCapability.forDocument(documentId) : null,
1116
+ [annotationCapability, documentId]
1117
+ );
1088
1118
  useEffect(() => {
1089
1119
  if (annotationProvides) {
1090
- annotationProvides.onStateChange((state) => {
1120
+ const currentState = annotationProvides.getState();
1121
+ setAnnotations(getAnnotationsByPageIndex(currentState, pageIndex));
1122
+ setSelectionState(getSelectedAnnotationByPageIndex(currentState, pageIndex));
1123
+ return annotationProvides.onStateChange((state) => {
1091
1124
  setAnnotations(getAnnotationsByPageIndex(state, pageIndex));
1092
1125
  setSelectionState(getSelectedAnnotationByPageIndex(state, pageIndex));
1093
1126
  });
1094
1127
  }
1095
- }, [annotationProvides]);
1128
+ }, [annotationProvides, pageIndex]);
1096
1129
  const handlers = useMemo(
1097
1130
  () => ({
1098
1131
  onPointerDown: (_, pe) => {
@@ -1118,7 +1151,9 @@ function Annotations(annotationsProps) {
1118
1151
  [annotationProvides, selectionProvides, editingId, pageIndex]
1119
1152
  );
1120
1153
  useEffect(() => {
1121
- return register(handlers);
1154
+ return register(handlers, {
1155
+ documentId
1156
+ });
1122
1157
  }, [register, handlers]);
1123
1158
  return /* @__PURE__ */ jsx(Fragment, { children: annotations.map((annotation) => {
1124
1159
  const isSelected = (selectionState == null ? void 0 : selectionState.object.id) === annotation.object.id;
@@ -1466,6 +1501,7 @@ function Annotations(annotationsProps) {
1466
1501
  {
1467
1502
  isSelected,
1468
1503
  annotation,
1504
+ documentId,
1469
1505
  pageIndex,
1470
1506
  scale,
1471
1507
  onClick: (e) => handleClick(e, annotation)
@@ -1478,7 +1514,7 @@ function Annotations(annotationsProps) {
1478
1514
  return null;
1479
1515
  }) });
1480
1516
  }
1481
- function TextMarkup({ pageIndex, scale }) {
1517
+ function TextMarkup({ documentId, pageIndex, scale }) {
1482
1518
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
1483
1519
  const { provides: selectionProvides } = useSelectionCapability();
1484
1520
  const { provides: annotationProvides } = useAnnotationCapability();
@@ -1487,17 +1523,16 @@ function TextMarkup({ pageIndex, scale }) {
1487
1523
  const [activeTool, setActiveTool] = useState(null);
1488
1524
  useEffect(() => {
1489
1525
  if (!selectionProvides) return;
1490
- const off = selectionProvides.onSelectionChange(() => {
1491
- setRects(selectionProvides.getHighlightRectsForPage(pageIndex));
1492
- setBoundingRect(selectionProvides.getBoundingRectForPage(pageIndex));
1526
+ return selectionProvides.forDocument(documentId).onSelectionChange(() => {
1527
+ setRects(selectionProvides.forDocument(documentId).getHighlightRectsForPage(pageIndex));
1528
+ setBoundingRect(selectionProvides.forDocument(documentId).getBoundingRectForPage(pageIndex));
1493
1529
  });
1494
- return off;
1495
- }, [selectionProvides, pageIndex]);
1530
+ }, [selectionProvides, documentId, pageIndex]);
1496
1531
  useEffect(() => {
1497
1532
  if (!annotationProvides) return;
1498
- const off = annotationProvides.onActiveToolChange(setActiveTool);
1499
- return off;
1500
- }, [annotationProvides]);
1533
+ setActiveTool(annotationProvides.forDocument(documentId).getActiveTool());
1534
+ return annotationProvides.forDocument(documentId).onActiveToolChange((event) => setActiveTool(event));
1535
+ }, [annotationProvides, documentId]);
1501
1536
  if (!boundingRect) return null;
1502
1537
  if (!activeTool || !activeTool.defaults) return null;
1503
1538
  switch (activeTool.defaults.type) {
@@ -1633,7 +1668,7 @@ function PreviewRenderer({ preview, scale }) {
1633
1668
  }
1634
1669
  return null;
1635
1670
  }
1636
- function AnnotationPaintLayer({ pageIndex, scale }) {
1671
+ function AnnotationPaintLayer({ documentId, pageIndex, scale }) {
1637
1672
  const { plugin: annotationPlugin } = useAnnotationPlugin();
1638
1673
  const [previews, setPreviews] = useState(/* @__PURE__ */ new Map());
1639
1674
  const fileInputRef = useRef(null);
@@ -1682,7 +1717,7 @@ function AnnotationPaintLayer({ pageIndex, scale }) {
1682
1717
  );
1683
1718
  useEffect(() => {
1684
1719
  if (!annotationPlugin) return;
1685
- return annotationPlugin.registerPageHandlers(pageIndex, scale, {
1720
+ return annotationPlugin.registerPageHandlers(documentId, pageIndex, scale, {
1686
1721
  services,
1687
1722
  onPreview: (toolId, state) => {
1688
1723
  setPreviews((prev) => {
@@ -1696,7 +1731,7 @@ function AnnotationPaintLayer({ pageIndex, scale }) {
1696
1731
  });
1697
1732
  }
1698
1733
  });
1699
- }, [pageIndex, scale, annotationPlugin, services]);
1734
+ }, [documentId, pageIndex, scale, annotationPlugin, services]);
1700
1735
  return /* @__PURE__ */ jsxs(Fragment, { children: [
1701
1736
  /* @__PURE__ */ jsx("input", { ref: fileInputRef, type: "file", style: { display: "none" } }),
1702
1737
  /* @__PURE__ */ jsx("canvas", { ref: canvasRef, style: { display: "none" } }),
@@ -1705,18 +1740,30 @@ function AnnotationPaintLayer({ pageIndex, scale }) {
1705
1740
  }
1706
1741
  function AnnotationLayer({
1707
1742
  style,
1743
+ documentId,
1708
1744
  pageIndex,
1709
- scale,
1745
+ scale: overrideScale,
1746
+ rotation: overrideRotation,
1710
1747
  selectionMenu,
1711
1748
  resizeUI,
1712
1749
  vertexUI,
1713
- pageWidth,
1714
- pageHeight,
1715
- rotation,
1716
1750
  selectionOutlineColor,
1717
1751
  customAnnotationRenderer,
1718
1752
  ...props
1719
1753
  }) {
1754
+ var _a, _b, _c, _d;
1755
+ const documentState = useDocumentState(documentId);
1756
+ const page = (_b = (_a = documentState == null ? void 0 : documentState.document) == null ? void 0 : _a.pages) == null ? void 0 : _b[pageIndex];
1757
+ const width = ((_c = page == null ? void 0 : page.size) == null ? void 0 : _c.width) ?? 0;
1758
+ const height = ((_d = page == null ? void 0 : page.size) == null ? void 0 : _d.height) ?? 0;
1759
+ const actualScale = useMemo(() => {
1760
+ if (overrideScale !== void 0) return overrideScale;
1761
+ return (documentState == null ? void 0 : documentState.scale) ?? 1;
1762
+ }, [overrideScale, documentState == null ? void 0 : documentState.scale]);
1763
+ const actualRotation = useMemo(() => {
1764
+ if (overrideRotation !== void 0) return overrideRotation;
1765
+ return (documentState == null ? void 0 : documentState.rotation) ?? Rotation.Degree0;
1766
+ }, [overrideRotation, documentState == null ? void 0 : documentState.rotation]);
1720
1767
  return /* @__PURE__ */ jsxs(
1721
1768
  "div",
1722
1769
  {
@@ -1728,20 +1775,21 @@ function AnnotationLayer({
1728
1775
  /* @__PURE__ */ jsx(
1729
1776
  Annotations,
1730
1777
  {
1778
+ documentId,
1731
1779
  selectionMenu,
1732
1780
  pageIndex,
1733
- scale,
1734
- rotation,
1735
- pageWidth,
1736
- pageHeight,
1781
+ scale: actualScale,
1782
+ rotation: actualRotation,
1783
+ pageWidth: width,
1784
+ pageHeight: height,
1737
1785
  resizeUI,
1738
1786
  vertexUI,
1739
1787
  selectionOutlineColor,
1740
1788
  customAnnotationRenderer
1741
1789
  }
1742
1790
  ),
1743
- /* @__PURE__ */ jsx(TextMarkup, { pageIndex, scale }),
1744
- /* @__PURE__ */ jsx(AnnotationPaintLayer, { pageIndex, scale })
1791
+ /* @__PURE__ */ jsx(TextMarkup, { documentId, pageIndex, scale: actualScale }),
1792
+ /* @__PURE__ */ jsx(AnnotationPaintLayer, { documentId, pageIndex, scale: actualScale })
1745
1793
  ]
1746
1794
  }
1747
1795
  );