Skip to content

Commit 509b004

Browse files
authored
Merge pull request #369 from OpenSignLabs/api-v1-beta
2 parents 3a2f626 + f1b7e11 commit 509b004

File tree

2 files changed

+56
-45
lines changed

2 files changed

+56
-45
lines changed

microfrontends/SignDocuments/src/Component/DebugUi.js

Lines changed: 42 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,9 @@ const DebugUi = () => {
148148
const handleMouseDown = (event) => {
149149
if (newAnnotation.length === 0) {
150150
const { x, y } = event.target.getStage().getPointerPosition();
151-
setNewAnnotation([{ x, y, width: 0, height: 0, key: "0" }]);
151+
setNewAnnotation([
152+
{ x, y, width: 0, height: 0, key: "0", page: pageNumber }
153+
]);
152154
}
153155
};
154156

@@ -158,7 +160,11 @@ const DebugUi = () => {
158160
const sy = newAnnotation[0].y;
159161
const { x, y } = event.target.getStage().getPointerPosition();
160162
const result = processDimensions(sx, sy, x - sx, y - sy);
161-
const annotationToAdd = { ...result, key: annotations.length + 1 };
163+
const annotationToAdd = {
164+
...result,
165+
key: annotations.length + 1,
166+
page: pageNumber
167+
};
162168
annotations.push(annotationToAdd);
163169
setNewAnnotation([]);
164170
setAnnotations(annotations);
@@ -181,6 +187,7 @@ const DebugUi = () => {
181187
y: sy,
182188
width: x - sx,
183189
height: y - sy,
190+
page: pageNumber,
184191
key: "0"
185192
}
186193
]);
@@ -349,38 +356,40 @@ const DebugUi = () => {
349356
<code
350357
style={{ fontSize: 12, color: "black", cursor: "pointer" }}
351358
>
352-
{` ["x": ${coord.x}, "y": ${coord.y}, "w": ${coord.width}, "h": ${coord.height}]`}
359+
{` ["page":${coord?.page}, "x": ${coord.x}, "y": ${coord.y}, "w": ${coord.width}, "h": ${coord.height}]`}
353360
</code>
354-
<span
355-
style={{
356-
borderRadius: 4,
357-
padding: "3px 5px",
358-
border: "1px solid gray",
359-
fontSize: 12,
360-
margin: 2,
361-
cursor: "pointer"
362-
}}
363-
onClick={() =>
364-
copytoclipboard(
365-
`["x": ${coord.x}, "y": ${coord.y}, "w": ${coord.width}, "h": ${coord.height}]`
366-
)
367-
}
368-
>
369-
<i className="fa-solid fa-copy"></i>
370-
</span>
371-
<span
372-
style={{
373-
borderRadius: 4,
374-
padding: "3px 5px",
375-
border: "1px solid gray",
376-
fontSize: 12,
377-
margin: 2,
378-
cursor: "pointer"
379-
}}
380-
onClick={() => handleDelete(coord.key)}
381-
>
382-
<i className="fa-solid fa-trash-can"></i>
383-
</span>
361+
<div>
362+
<span
363+
style={{
364+
borderRadius: 4,
365+
padding: "3px 5px",
366+
border: "1px solid gray",
367+
fontSize: 12,
368+
margin: 2,
369+
cursor: "pointer"
370+
}}
371+
onClick={() =>
372+
copytoclipboard(
373+
`"page":${coord?.page}, "x": ${coord.x}, "y": ${coord.y}, "w": ${coord.width}, "h": ${coord.height}`
374+
)
375+
}
376+
>
377+
<i className="fa-solid fa-copy"></i>
378+
</span>
379+
<span
380+
style={{
381+
borderRadius: 4,
382+
padding: "3px 5px",
383+
border: "1px solid gray",
384+
fontSize: 12,
385+
margin: 2,
386+
cursor: "pointer"
387+
}}
388+
onClick={() => handleDelete(coord.key)}
389+
>
390+
<i className="fa-solid fa-trash-can"></i>
391+
</span>
392+
</div>
384393
</li>
385394
))}
386395
</ul>

microfrontends/SignDocuments/src/Component/component/RenderDebugPdf.js

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -61,18 +61,20 @@ const RenderDebugPdf = (props) => {
6161
style={{ position: "absolute", top: 0, left: 0 }}
6262
>
6363
<Layer>
64-
{props.annotations.map((value) => {
65-
return (
66-
<Rect
67-
x={value.x}
68-
y={value.y}
69-
width={value.width}
70-
height={value.height}
71-
fill="transparent"
72-
stroke="black"
73-
/>
74-
);
75-
})}
64+
{props.annotations
65+
.filter((value) => value.page === props.pageNumber)
66+
.map((value) => {
67+
return (
68+
<Rect
69+
x={value.x}
70+
y={value.y}
71+
width={value.width}
72+
height={value.height}
73+
fill="transparent"
74+
stroke="black"
75+
/>
76+
);
77+
})}
7678
</Layer>
7779
</Stage>
7880
</div>

0 commit comments

Comments
 (0)