From e78a3991f03a6097b25670182526920318a7129b Mon Sep 17 00:00:00 2001 From: RaktimaNXG Date: Tue, 26 Mar 2024 09:50:46 +0530 Subject: [PATCH] fix: remoove unnecessary code --- apps/OpenSign/src/constant/Utils.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/apps/OpenSign/src/constant/Utils.js b/apps/OpenSign/src/constant/Utils.js index 67b1f9d7f..19a8662ab 100644 --- a/apps/OpenSign/src/constant/Utils.js +++ b/apps/OpenSign/src/constant/Utils.js @@ -1319,11 +1319,12 @@ export const multiSignEmbed = async ( let currentLine = ""; for (const word of textContent.split(" ")) { + //get text line width const lineWidth = font.widthOfTextAtSize( `${currentLine} ${word}`, fontSize ); - + //check text content line width is less or equal to container width if (lineWidth <= width) { currentLine += ` ${word}`; } else { @@ -1338,13 +1339,9 @@ export const multiSignEmbed = async ( // Function to break text into lines based on when user go next line on press enter button const breakTextIntoLines = (textContent, width) => { const lines = []; - let currentLine = ""; for (const word of textContent.split("\n")) { - const lineWidth = font.widthOfTextAtSize( - `${currentLine} ${word}`, - fontSize - ); + const lineWidth = font.widthOfTextAtSize(`${word}`, fontSize); //checking string length to container width //if string length is less then container width it means user press enter button if (lineWidth <= width) {