(page, field, rect, font)
| 4117 | } |
| 4118 | |
| 4119 | function _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 | |
| 4147 | function _drawOptionList(page, field, rect, font) { |
| 4148 | let selected = []; |
no test coverage detected