Die Rechtecke, die an dieser Stelle nicht verdeckt werden duerfen.
(anchor: Element)
| 133 | |
| 134 | /** Die Rechtecke, die an dieser Stelle nicht verdeckt werden duerfen. */ |
| 135 | function protectedRects(anchor: Element): HintRect[] { |
| 136 | const out: HintRect[] = []; |
| 137 | for (const node of document.querySelectorAll(HINT_PROTECTED_SELECTOR)) { |
| 138 | if (node === anchor || !rendered(node)) { |
| 139 | continue; |
| 140 | } |
| 141 | const style = window.getComputedStyle(node); |
| 142 | if (style.display === 'none' || style.visibility === 'hidden') { |
| 143 | continue; |
| 144 | } |
| 145 | const rect = node.getBoundingClientRect(); |
| 146 | if (rect.width <= 0 || rect.height <= 0) { |
| 147 | continue; |
| 148 | } |
| 149 | out.push({ x: rect.left, y: rect.top, width: rect.width, height: rect.height }); |
| 150 | } |
| 151 | return out; |
| 152 | } |
| 153 | |
| 154 | /** Zwei Rueckrufe hintereinander, wo der Ausloeser schon einen hatte. */ |
| 155 | function both<T>(first: ((value: T) => void) | undefined, second: (value: T) => void) { |