(boundary: WireFlowBoundary)
| 187 | |
| 188 | /** Exact rendered height of an end cap, which its CSS then pins as a minimum. */ |
| 189 | export function endCapHeight(boundary: WireFlowBoundary): number { |
| 190 | const text = endCapText(boundary); |
| 191 | let h = END_CAP_PADDING * 2; |
| 192 | h += wrappedLines(`Where the graph stops. ${text.intro}`) * END_CAP_LINE; |
| 193 | for (const site of text.sites) { |
| 194 | h += END_CAP_GAP; |
| 195 | h += wrappedLines(site.headline) * END_CAP_LINE; |
| 196 | if (site.key !== null) h += END_CAP_ROW; |
| 197 | for (const note of site.notes) h += wrappedLines(note) * END_CAP_LINE; |
| 198 | if (site.candidateHeading !== null) { |
| 199 | h += END_CAP_LINE + site.candidates.length * END_CAP_ROW; |
| 200 | } else if (site.candidateNote !== null) { |
| 201 | h += wrappedLines(site.candidateNote) * END_CAP_LINE; |
| 202 | } |
| 203 | } |
| 204 | if (text.quiet !== null) h += END_CAP_GAP + wrappedLines(text.quiet) * END_CAP_LINE; |
| 205 | if (text.uncertainHeading !== null) { |
| 206 | h += END_CAP_GAP + wrappedLines(text.uncertainHeading) * END_CAP_LINE; |
| 207 | h += text.uncertain.length * END_CAP_ROW; |
| 208 | } |
| 209 | if (text.further !== null) h += END_CAP_GAP + wrappedLines(text.further) * END_CAP_LINE; |
| 210 | if (text.missed !== null) h += END_CAP_GAP + wrappedLines(text.missed) * END_CAP_LINE; |
| 211 | return Math.round(h); |
| 212 | } |
| 213 | |
| 214 | /* ----------------------------------------------------------------- model -- */ |
| 215 |
no test coverage detected