From 732786067f97766acc9446cd18ed772b50372dc4 Mon Sep 17 00:00:00 2001 From: RaktimaNXG Date: Wed, 30 Oct 2024 13:56:26 +0530 Subject: [PATCH 1/6] 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 800ef7adf6..697c429178 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 953eb8e143..2ea5365994 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 d5efe160dc..06ee5a760e 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 5935637809..6f8863b70a 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 f70de6b457..c35a24c826 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 9ed7d8ef34..ec4acfbdfb 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 5a0b790855..002ab26b33 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 || From b3252e276b5a975d21547781c21eadfefe6bd332 Mon Sep 17 00:00:00 2001 From: RaktimaNXG Date: Mon, 4 Nov 2024 15:43:45 +0530 Subject: [PATCH 2/6] fix: remove blank space from text widgets,fix text size conflict issue --- .../src/components/pdf/Placeholder.js | 2 +- apps/OpenSign/src/constant/Utils.js | 53 ++++++++----------- apps/OpenSign/src/pages/PdfRequestFiles.js | 4 +- apps/OpenSign/src/pages/PlaceHolderSign.js | 4 +- apps/OpenSign/src/pages/SignyourselfPdf.js | 8 +-- 5 files changed, 26 insertions(+), 45 deletions(-) diff --git a/apps/OpenSign/src/components/pdf/Placeholder.js b/apps/OpenSign/src/components/pdf/Placeholder.js index 2ea5365994..c401d51cde 100644 --- a/apps/OpenSign/src/components/pdf/Placeholder.js +++ b/apps/OpenSign/src/components/pdf/Placeholder.js @@ -651,7 +651,7 @@ function Placeholder(props) { const fontSize = (size || 12) * containerScale * props.scale; //isMinHeight to set text box minimum height if (isMinHeight) { - return fontSize * 1.5 + "px"; + return fontSize * 1.2 + "px"; } else { return fontSize + "px"; } diff --git a/apps/OpenSign/src/constant/Utils.js b/apps/OpenSign/src/constant/Utils.js index 06ee5a760e..5e24351283 100644 --- a/apps/OpenSign/src/constant/Utils.js +++ b/apps/OpenSign/src/constant/Utils.js @@ -465,27 +465,27 @@ export const defaultWidthHeight = (type) => { case "checkbox": return { width: 15, height: 15 }; case textInputWidget: - return { width: 150, height: 25 }; + return { width: 150, height: 13 }; case "dropdown": return { width: 120, height: 22 }; case "initials": return { width: 50, height: 50 }; case "name": - return { width: 150, height: 25 }; + return { width: 150, height: 13 }; case "company": - return { width: 150, height: 25 }; + return { width: 150, height: 13 }; case "job title": - return { width: 150, height: 25 }; + return { width: 150, height: 13 }; case "date": return { width: 100, height: 20 }; case "image": return { width: 70, height: 70 }; case "email": - return { width: 150, height: 20 }; + return { width: 150, height: 13 }; case radioButtonWidget: return { width: 5, height: 10 }; case textWidget: - return { width: 150, height: 25 }; + return { width: 150, height: 13 }; default: return { width: 150, height: 60 }; } @@ -1013,7 +1013,7 @@ export const calculateInitialWidthHeight = (widgetData) => { const intialText = widgetData; const span = document.createElement("span"); span.textContent = intialText; - span.style.font = `14px`; // here put your text size and font family + span.style.font = `12px`; // here put your text size and font family span.style.display = "hidden"; document.body.appendChild(span); const width = span.offsetWidth; @@ -1303,12 +1303,6 @@ export const changeImageWH = async (base64Image) => { }); }; -//function to calculate font size of text area widgets -const calculateFontSize = (position) => { - const fontSize = position?.options?.fontSize || 12; - return fontSize; -}; - const getWidgetsFontColor = (type) => { switch (type) { case "red": @@ -1324,14 +1318,7 @@ const getWidgetsFontColor = (type) => { } }; //function for embed multiple signature using pdf-lib -export const multiSignEmbed = async ( - widgets, - pdfDoc, - signyourself, - scale, - pdfOriginalWH, - containerWH -) => { +export const multiSignEmbed = async (widgets, pdfDoc, signyourself, scale) => { // `fontBytes` is used to embed custom font in pdf const fontBytes = await fileasbytes( "https://cdn.opensignlabs.com/webfonts/times.ttf" @@ -1341,11 +1328,6 @@ export const multiSignEmbed = async ( let hasError = false; for (let item of widgets) { if (hasError) break; // Stop the outer loop if an error occurred - const containerScale = getContainerScale( - pdfOriginalWH, - item?.pageNumber, - containerWH - ); const typeExist = item.pos.some((data) => data?.type); let updateItem; @@ -1432,7 +1414,17 @@ export const multiSignEmbed = async ( return y; } } else { - return resizePos; + const WidgetsTypeTextExist = [ + textWidget, + textInputWidget, + "name", + "company", + "job title", + "date", + "email" + ].includes(position.type); + const yPosition = WidgetsTypeTextExist ? resizePos + 6 : resizePos; + return yPosition; } }; const color = position?.options?.fontColor; @@ -1508,7 +1500,7 @@ export const multiSignEmbed = async ( }); } } else if (widgetTypeExist) { - const fontSize = calculateFontSize(position); + const fontSize = position?.options?.fontSize || 12; parseInt(fontSize); let textContent; if (position?.options?.response) { @@ -1541,7 +1533,6 @@ export const multiSignEmbed = async ( lines.push(currentLine.trim()); return lines; }; - // Function to break text into lines based on when user go next line on press enter button const breakTextIntoLines = (textContent, width) => { const lines = []; @@ -1562,7 +1553,6 @@ export const multiSignEmbed = async ( return lines; }; - //check if text content have `\n` string it means user press enter to go next line and handle condition //else auto adjust text content according to container width const lines = isNewOnEnterLineExist @@ -1589,7 +1579,6 @@ export const multiSignEmbed = async ( } } else if (position.type === "dropdown") { const fontsize = parseInt(position?.options?.fontSize) || 12; - const dropdownRandomId = "dropdown" + randomId(); const dropdown = form.createDropdown(dropdownRandomId); dropdown.addOptions(position?.options?.values); @@ -1688,7 +1677,7 @@ export const multiSignEmbed = async ( } if (!hasError) { const pdfBytes = await pdfDoc.saveAsBase64({ useObjectStreams: false }); - // console.log("pdf", pdfBytes); + //console.log("pdf", pdfBytes); return pdfBytes; } else { return { diff --git a/apps/OpenSign/src/pages/PdfRequestFiles.js b/apps/OpenSign/src/pages/PdfRequestFiles.js index 0e0748d3fa..d327a23711 100644 --- a/apps/OpenSign/src/pages/PdfRequestFiles.js +++ b/apps/OpenSign/src/pages/PdfRequestFiles.js @@ -924,9 +924,7 @@ function PdfRequestFiles(props) { widgets, pdfDoc, isSignYourSelfFlow, - scale, - pdfOriginalWH, - containerWH + scale ); // console.log("pdfte", pdfBytes); //get ExistUserPtr object id of user class to get tenantDetails diff --git a/apps/OpenSign/src/pages/PlaceHolderSign.js b/apps/OpenSign/src/pages/PlaceHolderSign.js index c35a24c826..3e671e512b 100644 --- a/apps/OpenSign/src/pages/PlaceHolderSign.js +++ b/apps/OpenSign/src/pages/PlaceHolderSign.js @@ -814,9 +814,7 @@ function PlaceHolderSign() { placeholder, pdfDoc, isSignYourSelfFlow, - scale, - pdfOriginalWH, - containerWH + scale ); const pdfUrl = await convertBase64ToFile(pdfDetails[0].Name, pdfBase64); const tenantId = localStorage.getItem("TenantId"); diff --git a/apps/OpenSign/src/pages/SignyourselfPdf.js b/apps/OpenSign/src/pages/SignyourselfPdf.js index ec4acfbdfb..54930292ab 100644 --- a/apps/OpenSign/src/pages/SignyourselfPdf.js +++ b/apps/OpenSign/src/pages/SignyourselfPdf.js @@ -457,9 +457,7 @@ function SignYourSelf() { const getWidth = widgetTypeExist ? calculateInitialWidthHeight(widgetValue).getWidth : defaultWidthHeight(dragTypeValue).width; - const getHeight = widgetTypeExist - ? calculateInitialWidthHeight(widgetValue).getHeight - : defaultWidthHeight(dragTypeValue).height; + const getHeight = defaultWidthHeight(dragTypeValue).height; dropObj = { xPosition: getXPosition / (containerScale * scale), yPosition: getYPosition / (containerScale * scale), @@ -661,9 +659,7 @@ function SignYourSelf() { xyPostion, pdfDoc, isSignYourSelfFlow, - scale, - pdfOriginalWH, - containerWH + scale ); // console.log("pdf", pdfBytes); //function for call to embed signature in pdf and get digital signature pdf From c3a14b82b34aad4155d05268d47d738c14cdbfe9 Mon Sep 17 00:00:00 2001 From: RaktimaNXG Date: Mon, 4 Nov 2024 16:07:49 +0530 Subject: [PATCH 3/6] refactor code --- apps/OpenSign/src/constant/Utils.js | 1 - 1 file changed, 1 deletion(-) diff --git a/apps/OpenSign/src/constant/Utils.js b/apps/OpenSign/src/constant/Utils.js index 5e24351283..36381a6532 100644 --- a/apps/OpenSign/src/constant/Utils.js +++ b/apps/OpenSign/src/constant/Utils.js @@ -1677,7 +1677,6 @@ export const multiSignEmbed = async (widgets, pdfDoc, signyourself, scale) => { } if (!hasError) { const pdfBytes = await pdfDoc.saveAsBase64({ useObjectStreams: false }); - //console.log("pdf", pdfBytes); return pdfBytes; } else { return { From 0d86f39ba35d807b2189a705ddffb155aa26cc5e Mon Sep 17 00:00:00 2001 From: RaktimaNXG Date: Mon, 4 Nov 2024 16:48:02 +0530 Subject: [PATCH 4/6] refactor code --- apps/OpenSign/src/constant/Utils.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/OpenSign/src/constant/Utils.js b/apps/OpenSign/src/constant/Utils.js index 36381a6532..6c8b1941c7 100644 --- a/apps/OpenSign/src/constant/Utils.js +++ b/apps/OpenSign/src/constant/Utils.js @@ -465,27 +465,27 @@ export const defaultWidthHeight = (type) => { case "checkbox": return { width: 15, height: 15 }; case textInputWidget: - return { width: 150, height: 13 }; + return { width: 150, height: 15 }; case "dropdown": return { width: 120, height: 22 }; case "initials": return { width: 50, height: 50 }; case "name": - return { width: 150, height: 13 }; + return { width: 150, height: 15 }; case "company": - return { width: 150, height: 13 }; + return { width: 150, height: 15 }; case "job title": - return { width: 150, height: 13 }; + return { width: 150, height: 15 }; case "date": return { width: 100, height: 20 }; case "image": return { width: 70, height: 70 }; case "email": - return { width: 150, height: 13 }; + return { width: 150, height: 15 }; case radioButtonWidget: return { width: 5, height: 10 }; case textWidget: - return { width: 150, height: 13 }; + return { width: 150, height: 15 }; default: return { width: 150, height: 60 }; } From 8db934a2c2d2e5b486104b4db9a94de88990fe7a Mon Sep 17 00:00:00 2001 From: RaktimaNXG Date: Mon, 4 Nov 2024 17:31:20 +0530 Subject: [PATCH 5/6] fix: increase space from bottom in text widgets --- apps/OpenSign/src/constant/Utils.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/apps/OpenSign/src/constant/Utils.js b/apps/OpenSign/src/constant/Utils.js index 6c8b1941c7..4b987af535 100644 --- a/apps/OpenSign/src/constant/Utils.js +++ b/apps/OpenSign/src/constant/Utils.js @@ -463,29 +463,29 @@ export const defaultWidthHeight = (type) => { case "stamp": return { width: 150, height: 60 }; case "checkbox": - return { width: 15, height: 15 }; + return { width: 15, height: 17 }; case textInputWidget: - return { width: 150, height: 15 }; + return { width: 150, height: 17 }; case "dropdown": return { width: 120, height: 22 }; case "initials": return { width: 50, height: 50 }; case "name": - return { width: 150, height: 15 }; + return { width: 150, height: 17 }; case "company": - return { width: 150, height: 15 }; + return { width: 150, height: 17 }; case "job title": - return { width: 150, height: 15 }; + return { width: 150, height: 17 }; case "date": return { width: 100, height: 20 }; case "image": return { width: 70, height: 70 }; case "email": - return { width: 150, height: 15 }; + return { width: 150, height: 17 }; case radioButtonWidget: return { width: 5, height: 10 }; case textWidget: - return { width: 150, height: 15 }; + return { width: 150, height: 17 }; default: return { width: 150, height: 60 }; } From 24ce6eae3bd6e9423191a2a203f69daa82a1cc5a Mon Sep 17 00:00:00 2001 From: RaktimaNXG Date: Mon, 4 Nov 2024 18:09:38 +0530 Subject: [PATCH 6/6] fix: remove extra space from bottom after embed text widgets in mobile view --- apps/OpenSign/src/pages/SignyourselfPdf.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/apps/OpenSign/src/pages/SignyourselfPdf.js b/apps/OpenSign/src/pages/SignyourselfPdf.js index 54930292ab..907bdf8e40 100644 --- a/apps/OpenSign/src/pages/SignyourselfPdf.js +++ b/apps/OpenSign/src/pages/SignyourselfPdf.js @@ -424,9 +424,7 @@ function SignYourSelf() { const getWidth = widgetTypeExist ? calculateInitialWidthHeight(dragTypeValue, widgetValue).getWidth : defaultWidthHeight(dragTypeValue).width; - const getHeight = widgetTypeExist - ? calculateInitialWidthHeight(dragTypeValue, widgetValue).getHeight - : defaultWidthHeight(dragTypeValue).height; + const getHeight = defaultWidthHeight(dragTypeValue).height; dropObj = { xPosition: getWidth / 2 + containerWH.width / 2,