♻️ 🚧 date and text field

This commit is contained in:
Timur Ercan
2023-02-28 19:36:21 +01:00
parent fc93f80a8b
commit 2f02134bc4
5 changed files with 25 additions and 13 deletions

View File

@ -1,11 +1,12 @@
import { FieldType } from "@prisma/client";
export const createField = function addField(
export const createField = (
e: any,
page: number,
selectedRecipient: any,
type: FieldType = FieldType.SIGNATURE
): any {
type: FieldType = FieldType.SIGNATURE,
customText = ""
): any => {
var rect = e.target.getBoundingClientRect();
const fieldSize = { width: 192, height: 96 };
var newFieldX = e.clientX - rect.left - fieldSize.width / 2; //x position within the element.
@ -25,6 +26,7 @@ export const createField = function addField(
positionX: newFieldX.toFixed(0),
positionY: newFieldY.toFixed(0),
Recipient: selectedRecipient,
customText: customText,
};
return signatureField;