From 048e529bb567d6a6cc02a5b8376cc2a691500866 Mon Sep 17 00:00:00 2001 From: RaktimaNXG Date: Wed, 14 Aug 2024 11:41:18 +0530 Subject: [PATCH] fix: checkbox & radio button labels font color issue --- apps/OpenSign/src/constant/Utils.js | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/apps/OpenSign/src/constant/Utils.js b/apps/OpenSign/src/constant/Utils.js index 4a9113ee7..702ae1ef3 100644 --- a/apps/OpenSign/src/constant/Utils.js +++ b/apps/OpenSign/src/constant/Utils.js @@ -1367,7 +1367,8 @@ export const multiSignEmbed = async ( } }; const color = position?.options?.fontColor; - let updateColorInRgb = getWidgetsFontColor(color); + const updateColorInRgb = getWidgetsFontColor(color); + const fontSize = parseInt(position?.options?.fontSize); const widgetTypeExist = [ textWidget, textInputWidget, @@ -1380,7 +1381,7 @@ export const multiSignEmbed = async ( if (position.type === "checkbox") { let checkboxOptionGapFromTop, isCheck; let y = yPos(position); - const optionsFontSize = parseInt(position?.options?.fontSize) || 13; + const optionsFontSize = fontSize || 13; const checkboxSize = 18; const checkboxTextGapFromLeft = 22; if (position?.options?.values.length > 0) { @@ -1413,10 +1414,9 @@ export const multiSignEmbed = async ( 1, page.getSize(), optionsFontSize, - rgb(0, 0, 0), + updateColorInRgb, font, - page, - updateColorInRgb + page ); page.drawText(item, optionsPosition); } @@ -1527,14 +1527,12 @@ export const multiSignEmbed = async ( const dropdownRandomId = "dropdown" + randomId(); const dropdown = form.createDropdown(dropdownRandomId); - dropdown.addOptions(position?.options?.values); if (position?.options?.response) { dropdown.select(position.options?.response); } else if (position?.options?.defaultValue) { dropdown.select(position?.options?.defaultValue); } - dropdown.setFontSize(12); const dropdownObj = { x: xPos(position), @@ -1542,13 +1540,8 @@ export const multiSignEmbed = async ( width: widgetWidth, height: widgetHeight }; - const dropdownOption = getWidgetPosition(page, dropdownObj, 1); - const dropdownSelected = { - ...dropdownOption, - font: font, - textColor: updateColorInRgb - }; + const dropdownSelected = { ...dropdownOption, font: font }; dropdown.defaultUpdateAppearances(font); dropdown.addToPage(page, dropdownSelected); dropdown.enableReadOnly(); @@ -1556,7 +1549,7 @@ export const multiSignEmbed = async ( const radioRandomId = "radio" + randomId(); const radioGroup = form.createRadioGroup(radioRandomId); let radioOptionGapFromTop; - const optionsFontSize = parseInt(position?.options?.fontSize) || 16; + const optionsFontSize = fontSize || 16; const radioTextGapFromLeft = 20; const radioSize = 18; let y = yPos(position); @@ -1577,10 +1570,9 @@ export const multiSignEmbed = async ( 1, page.getSize(), optionsFontSize, - rgb(0, 0, 0), + updateColorInRgb, font, - page, - updateColorInRgb + page ); page.drawText(item, optionsPosition);