( dataX: string | null, dataY: string | null, dx: number, dy: number, )
| 77 | * `data-x` / `data-y` default to 0 when absent or non-numeric. |
| 78 | */ |
| 79 | export function computeDraftPosition( |
| 80 | dataX: string | null, |
| 81 | dataY: string | null, |
| 82 | dx: number, |
| 83 | dy: number, |
| 84 | ): { x: number; y: number } { |
| 85 | const baseX = parseFloat(dataX ?? "0") || 0; |
| 86 | const baseY = parseFloat(dataY ?? "0") || 0; |
| 87 | return { x: baseX + dx, y: baseY + dy }; |
| 88 | } |
| 89 | |
| 90 | // ─── Image-alpha pure helpers (WS-G phase 1) ────────────────────────────────── |
| 91 |
no outgoing calls
no test coverage detected