MCPcopy Create free account
hub / github.com/OpenSignLabs/OpenSign / _drawDropdown

Function _drawDropdown

apps/OpenSign/src/constant/Utils.js:4119–4145  ·  view source on GitHub ↗
(page, field, rect, font)

Source from the content-addressed store, hash-verified

4117}
4118
4119function _drawDropdown(page, field, rect, font) {
4120 let text = "";
4121 try {
4122 const selected = field.getSelected?.();
4123 if (Array.isArray(selected)) {
4124 text = selected.join(", ");
4125 } else {
4126 text = selected ?? "";
4127 }
4128 } catch {
4129 text = "";
4130 }
4131
4132 text = String(text ?? "");
4133 if (!text) return;
4134
4135 const fontSize = _fitSingleLineFontSize(text, rect, font);
4136
4137 page.drawText(text, {
4138 x: rect.x + 2,
4139 y: rect.y + Math.max(2, (rect.height - fontSize) / 2),
4140 size: fontSize,
4141 font,
4142 color: rgb(0, 0, 0),
4143 maxWidth: Math.max(1, rect.width - 12)
4144 });
4145}
4146
4147function _drawOptionList(page, field, rect, font) {
4148 let selected = [];

Callers 1

flattenPdfFunction · 0.85

Calls 1

_fitSingleLineFontSizeFunction · 0.85

Tested by

no test coverage detected