(clientX: number, clientY: number, rect: DOMRect)
| 251 | } |
| 252 | |
| 253 | function distanceToRect(clientX: number, clientY: number, rect: DOMRect) { |
| 254 | const dx = clientX < rect.left ? rect.left - clientX : clientX > rect.right ? clientX - rect.right : 0; |
| 255 | const dy = clientY < rect.top ? rect.top - clientY : clientY > rect.bottom ? clientY - rect.bottom : 0; |
| 256 | if (dx === 0 && dy === 0) return 0; |
| 257 | return dx * dx + dy * dy; |
| 258 | } |
| 259 | |
| 260 | function scorePreviewRect(clientX: number, clientY: number, rect: DOMRect) { |
| 261 | const outsideDistance = distanceToRect(clientX, clientY, rect); |
no outgoing calls
no test coverage detected