Skip to content

Commit 912efeb

Browse files
refactor-code
1 parent e337a79 commit 912efeb

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

apps/OpenSign/src/components/pdf/SignPad.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ function SignPad({
9898
} else {
9999
if (isTab === "type") {
100100
setIsSignImg("");
101-
onSaveSign(null, false, textWidth, textHeight);
102101
onSaveSign(
103102
null,
104103
false,
@@ -216,11 +215,11 @@ function SignPad({
216215
: fontSelect
217216
? fontSelect
218217
: "Fasthand";
219-
218+
const fontSizeValue = isInitial ? "60px" : "40px";
220219
//creating span for getting text content width
221220
const span = document.createElement("span");
222221
span.textContent = textContent;
223-
span.style.font = `40px ${fontfamily}`; // here put your text size and font family
222+
span.style.font = `${fontSizeValue} ${fontfamily}`; // here put your text size and font family
224223
span.style.color = color ? color : penColor;
225224
span.style.display = "hidden";
226225
document.body.appendChild(span); // Replace 'container' with the ID of the container element
@@ -230,7 +229,7 @@ function SignPad({
230229
// Draw the text content on the canvas
231230
const ctx = canvasElement.getContext("2d");
232231
const pixelRatio = window.devicePixelRatio || 1;
233-
const addExtraWidth = isInitial ? 0 : 50;
232+
const addExtraWidth = isInitial ? 20 : 50;
234233
const width = span.offsetWidth + addExtraWidth;
235234
const height = span.offsetHeight;
236235
setTextWidth(width);

0 commit comments

Comments
 (0)