Skip to content

Commit

Permalink
Merge pull request #881 from OpenSignLabs/raktima-opensignlabs-patch-10
Browse files Browse the repository at this point in the history
  • Loading branch information
nxglabs authored Jun 26, 2024
2 parents 6943128 + f15aa39 commit 4fdf229
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
26 changes: 19 additions & 7 deletions apps/OpenSign/src/components/pdf/SignPad.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,17 @@ function SignPad({
} else if (isStamp) {
setImage("");
}

setIsSignImg("");
} else if (isTab === "uploadImage") {
setImage("");
}
// setIsInitial(false);
};
//function for set signature url
const handleSignatureChange = () => {
setSignature(canvasRef.current.toDataURL());
setIsSignImg(canvasRef.current.toDataURL());
const handleSignatureChange = (data) => {
setSignature(data);
setIsSignImg(data);
};

//save button component
const SaveBtn = () => {
return (
Expand Down Expand Up @@ -103,6 +101,8 @@ function SignPad({
setIsSignImg("");
onSaveSign(null, false, textWidth, textHeight);
} else {
setIsSignImg("");
canvasRef.current.clear();
onSaveSign(signatureType);
}
}
Expand All @@ -127,6 +127,16 @@ function SignPad({
? ""
: "pointer-events-none"
} op-btn op-btn-primary shadow-lg`}
disabled={
(isTab === "draw" && isSignImg) ||
(isTab === "image" && image) ||
(isTab === "mysignature" && isDefaultSign) ||
(isTab === "type" && textWidth)
? false
: image
? false
: true
}
>
Save
</button>
Expand Down Expand Up @@ -193,7 +203,6 @@ function SignPad({
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [isTab]);

//function for convert input text value in image
const convertToImg = async (fontStyle, text, color) => {
//get text content to convert in image
Expand Down Expand Up @@ -304,6 +313,9 @@ function SignPad({
setIsImageSelect(false);
setIsTab("draw");
setImage();
if (isSignImg) {
setSignature(isSignImg);
}
}}
className={`${
isTab === "draw"
Expand Down Expand Up @@ -577,7 +589,7 @@ function SignPad({
}}
backgroundColor="rgb(255, 255, 255)"
onEnd={() =>
handleSignatureChange(canvasRef.current.toDataURL())
handleSignatureChange(canvasRef.current?.toDataURL())
}
dotSize={1}
/>
Expand Down
1 change: 0 additions & 1 deletion apps/OpenSign/src/pages/SignyourselfPdf.js
Original file line number Diff line number Diff line change
Expand Up @@ -865,7 +865,6 @@ function SignYourSelf() {
setSignBtnPosition([]);
setPageNumber((prevPageNumber) => prevPageNumber + offset);
}

//function for image upload or update
const onImageChange = (event) => {
if (event.target.files && event.target.files[0]) {
Expand Down

0 comments on commit 4fdf229

Please sign in to comment.