(rect: DOMRect)
| 40 | * @param rect |
| 41 | */ |
| 42 | const findLineKey = (rect: DOMRect) => { |
| 43 | for (const lineKey of lineKeys) { |
| 44 | const { right } = lineKey |
| 45 | const previousRects = lines.get(lineKey) |
| 46 | const lastRect = previousRects |
| 47 | ? previousRects |
| 48 | .concat() |
| 49 | .reverse() |
| 50 | .find(p => p.width > 0) ?? previousRects[previousRects.length - 1] |
| 51 | : null |
| 52 | if (isRectInLine(rect, lineKey) && rect.left <= (lastRect ? lastRect.right : right) + 1) { |
| 53 | return lineKey |
| 54 | } |
| 55 | } |
| 56 | return null |
| 57 | } |
| 58 | |
| 59 | // Loop through each rectangle and find its line |
| 60 | for (let r = 0; r < rects.length; r++) { |
no test coverage detected
searching dependent graphs…