(element: Element)
| 41 | // An element with no area of its own (an empty inline wrapper, say) is aimed |
| 42 | // at through its offsetParent's size, as bot.action.getInteractableSize did. |
| 43 | function interactableCentre(element: Element): Coordinate { |
| 44 | let node: Element = element |
| 45 | for (;;) { |
| 46 | const rect = getClientRect(node) |
| 47 | const parent = (node as HTMLElement).offsetParent |
| 48 | if ((rect.width > 0 && rect.height > 0) || !parent) { |
| 49 | return { x: rect.width / 2, y: rect.height / 2 } |
| 50 | } |
| 51 | node = parent |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | export default click |
no test coverage detected