(clientX: number, clientY: number, rect: DOMRect)
| 258 | } |
| 259 | |
| 260 | function scorePreviewRect(clientX: number, clientY: number, rect: DOMRect) { |
| 261 | const outsideDistance = distanceToRect(clientX, clientY, rect); |
| 262 | const centerX = rect.left + rect.width / 2; |
| 263 | const centerY = rect.top + rect.height / 2; |
| 264 | const dx = clientX - centerX; |
| 265 | const dy = clientY - centerY; |
| 266 | const centerDistance = dx * dx + dy * dy; |
| 267 | |
| 268 | if (outsideDistance === 0) { |
| 269 | return centerDistance; |
| 270 | } |
| 271 | |
| 272 | return outsideDistance * 16 + centerDistance; |
| 273 | } |
| 274 | |
| 275 | function getPointerGridCell(metrics: ContainerMetrics, clientX: number, clientY: number) { |
| 276 | const colUnit = metrics.cellWidth + metrics.colGap; |
no test coverage detected