(
inner: HtmlDomNode,
label: string,
topPad: number,
bottomPad: number,
options: Options,
)
| 297 | }; |
| 298 | |
| 299 | export const stretchyEnclose = function( |
| 300 | inner: HtmlDomNode, |
| 301 | label: string, |
| 302 | topPad: number, |
| 303 | bottomPad: number, |
| 304 | options: Options, |
| 305 | ): DomSpan | SvgSpan { |
| 306 | // Return an image span for \cancel, \bcancel, \xcancel, \fbox, or \angl |
| 307 | let img; |
| 308 | const totalHeight = inner.height + inner.depth + topPad + bottomPad; |
| 309 | |
| 310 | if (/fbox|color|angl/.test(label)) { |
| 311 | img = makeSpan(["stretchy", label], [], options); |
| 312 | |
| 313 | if (label === "fbox") { |
| 314 | const color = options.color && options.getColor(); |
| 315 | if (color) { |
| 316 | img.style.borderColor = color; |
| 317 | } |
| 318 | } |
| 319 | |
| 320 | } else { |
| 321 | // \cancel, \bcancel, or \xcancel |
| 322 | // Since \cancel's SVG is inline and it omits the viewBox attribute, |
| 323 | // its stroke-width will not vary with span area. |
| 324 | |
| 325 | const lines = []; |
| 326 | if (/^[bx]cancel$/.test(label)) { |
| 327 | lines.push(new LineNode({ |
| 328 | "x1": "0", |
| 329 | "y1": "0", |
| 330 | "x2": "100%", |
| 331 | "y2": "100%", |
| 332 | "stroke-width": "0.046em", |
| 333 | })); |
| 334 | } |
| 335 | |
| 336 | if (/^x?cancel$/.test(label)) { |
| 337 | lines.push(new LineNode({ |
| 338 | "x1": "0", |
| 339 | "y1": "100%", |
| 340 | "x2": "100%", |
| 341 | "y2": "0", |
| 342 | "stroke-width": "0.046em", |
| 343 | })); |
| 344 | } |
| 345 | |
| 346 | const svgNode = new SvgNode(lines, { |
| 347 | "width": "100%", |
| 348 | "height": makeEm(totalHeight), |
| 349 | }); |
| 350 | |
| 351 | img = makeSvgSpan([], [svgNode], options); |
| 352 | } |
| 353 | |
| 354 | img.height = totalHeight; |
| 355 | img.style.height = makeEm(totalHeight); |
| 356 |
no test coverage detected
searching dependent graphs…