| 440 | |
| 441 | /** Die Rechtecke der einzelnen Zeilen des eigenen Textes eines Elements. */ |
| 442 | const lineRects = (node) => { |
| 443 | const rects = []; |
| 444 | const range = document.createRange(); |
| 445 | for (const child of node.childNodes) { |
| 446 | if (child.nodeType !== Node.TEXT_NODE || (child.nodeValue ?? '').trim().length === 0) { |
| 447 | continue; |
| 448 | } |
| 449 | range.selectNodeContents(child); |
| 450 | rects.push(...range.getClientRects()); |
| 451 | } |
| 452 | return rects; |
| 453 | }; |
| 454 | |
| 455 | // ------------------------------------------------------- (b) Beschneidung |
| 456 | const clipped = []; |