From 732786067f97766acc9446cd18ed772b50372dc4 Mon Sep 17 00:00:00 2001 From: RaktimaNXG Date: Wed, 30 Oct 2024 13:56:26 +0530 Subject: [PATCH] fix: text size issue after complete signature in mobile view --- .../src/components/pdf/DropdownWidgetOption.js | 4 ++-- apps/OpenSign/src/components/pdf/Placeholder.js | 6 +++--- .../src/components/pdf/TextFontSetting.js | 6 ++++-- .../src/components/pdf/WidgetNameModal.js | 4 ++-- apps/OpenSign/src/constant/Utils.js | 16 ++++------------ apps/OpenSign/src/pages/DraftTemplate.js | 10 +++++----- apps/OpenSign/src/pages/PlaceHolderSign.js | 10 +++++----- apps/OpenSign/src/pages/SignyourselfPdf.js | 7 ++----- apps/OpenSign/src/pages/TemplatePlaceholder.js | 10 +++++----- 9 files changed, 32 insertions(+), 41 deletions(-) diff --git a/apps/OpenSign/src/components/pdf/DropdownWidgetOption.js b/apps/OpenSign/src/components/pdf/DropdownWidgetOption.js index 800ef7adf..697c42917 100644 --- a/apps/OpenSign/src/components/pdf/DropdownWidgetOption.js +++ b/apps/OpenSign/src/components/pdf/DropdownWidgetOption.js @@ -339,9 +339,9 @@ function DropdownWidgetOption(props) { value={ props.fontSize || props.currWidgetsDetails?.options?.fontSize || - "12" + 12 } - onChange={(e) => props.setFontSize(e.target.value)} + onChange={(e) => props.setFontSize(parseInt(e.target.value))} > {fontsizeArr.map((size, ind) => { return ( diff --git a/apps/OpenSign/src/components/pdf/Placeholder.js b/apps/OpenSign/src/components/pdf/Placeholder.js index 953eb8e14..2ea536599 100644 --- a/apps/OpenSign/src/components/pdf/Placeholder.js +++ b/apps/OpenSign/src/components/pdf/Placeholder.js @@ -412,7 +412,7 @@ function Placeholder(props) { data?.format, null, null, - props.fontSize || props.pos?.options?.fontSize || "12", + props.fontSize || props.pos?.options?.fontSize || 12, props.fontColor || props.pos?.options?.fontColor || "black" ); setSelectDate({ date: date, format: data?.format }); @@ -948,8 +948,8 @@ function Placeholder(props) { {t("font-size")} : props.setFontSize(e.target.value)} + onChange={(e) => props.setFontSize(parseInt(e.target.value))} > {fontsizeArr.map((size, ind) => { return ( diff --git a/apps/OpenSign/src/constant/Utils.js b/apps/OpenSign/src/constant/Utils.js index d5efe160d..06ee5a760 100644 --- a/apps/OpenSign/src/constant/Utils.js +++ b/apps/OpenSign/src/constant/Utils.js @@ -1304,13 +1304,9 @@ export const changeImageWH = async (base64Image) => { }; //function to calculate font size of text area widgets -const calculateFontSize = (position, containerScale, signyourself) => { - const font = position?.options?.fontSize || 12; - if (!signyourself && position?.isMobile && position?.scale) { - return font / position?.scale / containerScale; - } else { - return font / containerScale; - } +const calculateFontSize = (position) => { + const fontSize = position?.options?.fontSize || 12; + return fontSize; }; const getWidgetsFontColor = (type) => { @@ -1512,11 +1508,7 @@ export const multiSignEmbed = async ( }); } } else if (widgetTypeExist) { - const fontSize = calculateFontSize( - position, - containerScale, - signyourself - ); + const fontSize = calculateFontSize(position); parseInt(fontSize); let textContent; if (position?.options?.response) { diff --git a/apps/OpenSign/src/pages/DraftTemplate.js b/apps/OpenSign/src/pages/DraftTemplate.js index 593563780..6f8863b70 100644 --- a/apps/OpenSign/src/pages/DraftTemplate.js +++ b/apps/OpenSign/src/pages/DraftTemplate.js @@ -1035,7 +1035,7 @@ const DraftTemplate = () => { isReadOnly: isReadOnly || false, isHideLabel: isHideLabel || false, fontSize: - fontSize || currWidgetsDetails?.options?.fontSize || "12", + fontSize || currWidgetsDetails?.options?.fontSize || 12, fontColor: fontColor || currWidgetsDetails?.options?.fontColor || @@ -1073,7 +1073,7 @@ const DraftTemplate = () => { defaultValue: defaultValue, isHideLabel: isHideLabel || false, fontSize: - fontSize || currWidgetsDetails?.options?.fontSize || "12", + fontSize || currWidgetsDetails?.options?.fontSize || 12, fontColor: fontColor || currWidgetsDetails?.options?.fontColor || @@ -1091,7 +1091,7 @@ const DraftTemplate = () => { values: dropdownOptions, defaultValue: defaultValue, fontSize: - fontSize || currWidgetsDetails?.options?.fontSize || "12", + fontSize || currWidgetsDetails?.options?.fontSize || 12, fontColor: fontColor || currWidgetsDetails?.options?.fontColor || @@ -1166,7 +1166,7 @@ const DraftTemplate = () => { } : {}, fontSize: - fontSize || currWidgetsDetails?.options?.fontSize || "12", + fontSize || currWidgetsDetails?.options?.fontSize || 12, fontColor: fontColor || currWidgetsDetails?.options?.fontColor || @@ -1182,7 +1182,7 @@ const DraftTemplate = () => { status: defaultdata.status, defaultValue: defaultdata.defaultValue, fontSize: - fontSize || currWidgetsDetails?.options?.fontSize || "12", + fontSize || currWidgetsDetails?.options?.fontSize || 12, fontColor: fontColor || currWidgetsDetails?.options?.fontColor || diff --git a/apps/OpenSign/src/pages/PlaceHolderSign.js b/apps/OpenSign/src/pages/PlaceHolderSign.js index f70de6b45..c35a24c82 100644 --- a/apps/OpenSign/src/pages/PlaceHolderSign.js +++ b/apps/OpenSign/src/pages/PlaceHolderSign.js @@ -1339,7 +1339,7 @@ function PlaceHolderSign() { isHideLabel: isHideLabel || false, defaultValue: defaultValue, fontSize: - fontSize || currWidgetsDetails?.options?.fontSize || "12", + fontSize || currWidgetsDetails?.options?.fontSize || 12, fontColor: fontColor || currWidgetsDetails?.options?.fontColor || @@ -1377,7 +1377,7 @@ function PlaceHolderSign() { isReadOnly: isReadOnly || false, isHideLabel: isHideLabel || false, fontSize: - fontSize || currWidgetsDetails?.options?.fontSize || "12", + fontSize || currWidgetsDetails?.options?.fontSize || 12, fontColor: fontColor || currWidgetsDetails?.options?.fontColor || @@ -1395,7 +1395,7 @@ function PlaceHolderSign() { values: dropdownOptions, defaultValue: defaultValue, fontSize: - fontSize || currWidgetsDetails?.options?.fontSize || "12", + fontSize || currWidgetsDetails?.options?.fontSize || 12, fontColor: fontColor || currWidgetsDetails?.options?.fontColor || @@ -1468,7 +1468,7 @@ function PlaceHolderSign() { } : {}, fontSize: - fontSize || currWidgetsDetails?.options?.fontSize || "12", + fontSize || currWidgetsDetails?.options?.fontSize || 12, fontColor: fontColor || currWidgetsDetails?.options?.fontColor || @@ -1484,7 +1484,7 @@ function PlaceHolderSign() { status: defaultdata.status, defaultValue: defaultdata.defaultValue, fontSize: - fontSize || currWidgetsDetails?.options?.fontSize || "12", + fontSize || currWidgetsDetails?.options?.fontSize || 12, fontColor: fontColor || currWidgetsDetails?.options?.fontColor || diff --git a/apps/OpenSign/src/pages/SignyourselfPdf.js b/apps/OpenSign/src/pages/SignyourselfPdf.js index 9ed7d8ef3..ec4acfbdf 100644 --- a/apps/OpenSign/src/pages/SignyourselfPdf.js +++ b/apps/OpenSign/src/pages/SignyourselfPdf.js @@ -1028,7 +1028,6 @@ function SignYourSelf() { const getPageNumer = xyPostion.filter( (data) => data.pageNumber === pageNumber ); - if (getPageNumer.length > 0) { const getXYdata = getPageNumer[0].pos; const getPosData = getXYdata; @@ -1058,7 +1057,7 @@ function SignYourSelf() { isReadOnly: isReadOnly, isHideLabel: isHideLabel || false, fontSize: - fontSize || currWidgetsDetails?.options?.fontSize || "12", + fontSize || currWidgetsDetails?.options?.fontSize || 12, fontColor: fontColor || currWidgetsDetails?.options?.fontColor || "black" } @@ -1092,7 +1091,6 @@ function SignYourSelf() { const getPageNumer = xyPostion.filter( (data) => data.pageNumber === pageNumber ); - if (getPageNumer.length > 0) { const getXYdata = getPageNumer[0].pos; const getPosData = getXYdata; @@ -1102,8 +1100,7 @@ function SignYourSelf() { ...position, options: { ...position.options, - fontSize: - fontSize || currWidgetsDetails?.options?.fontSize || "12", + fontSize: fontSize || currWidgetsDetails?.options?.fontSize || 12, fontColor: fontColor || currWidgetsDetails?.options?.fontColor || "black" } diff --git a/apps/OpenSign/src/pages/TemplatePlaceholder.js b/apps/OpenSign/src/pages/TemplatePlaceholder.js index 5a0b79085..002ab26b3 100644 --- a/apps/OpenSign/src/pages/TemplatePlaceholder.js +++ b/apps/OpenSign/src/pages/TemplatePlaceholder.js @@ -1123,7 +1123,7 @@ const TemplatePlaceholder = () => { isReadOnly: isReadOnly || false, isHideLabel: isHideLabel || false, fontSize: - fontSize || currWidgetsDetails?.options?.fontSize || "12", + fontSize || currWidgetsDetails?.options?.fontSize || 12, fontColor: fontColor || currWidgetsDetails?.options?.fontColor || @@ -1161,7 +1161,7 @@ const TemplatePlaceholder = () => { defaultValue: defaultValue, isHideLabel: isHideLabel || false, fontSize: - fontSize || currWidgetsDetails?.options?.fontSize || "12", + fontSize || currWidgetsDetails?.options?.fontSize || 12, fontColor: fontColor || currWidgetsDetails?.options?.fontColor || @@ -1179,7 +1179,7 @@ const TemplatePlaceholder = () => { values: dropdownOptions, defaultValue: defaultValue, fontSize: - fontSize || currWidgetsDetails?.options?.fontSize || "12", + fontSize || currWidgetsDetails?.options?.fontSize || 12, fontColor: fontColor || currWidgetsDetails?.options?.fontColor || @@ -1254,7 +1254,7 @@ const TemplatePlaceholder = () => { } : {}, fontSize: - fontSize || currWidgetsDetails?.options?.fontSize || "12", + fontSize || currWidgetsDetails?.options?.fontSize || 12, fontColor: fontColor || currWidgetsDetails?.options?.fontColor || @@ -1270,7 +1270,7 @@ const TemplatePlaceholder = () => { status: defaultdata.status, defaultValue: defaultdata.defaultValue, fontSize: - fontSize || currWidgetsDetails?.options?.fontSize || "12", + fontSize || currWidgetsDetails?.options?.fontSize || 12, fontColor: fontColor || currWidgetsDetails?.options?.fontColor ||