( screenX: number, screenY: number, vp: Viewport, )
| 38 | |
| 39 | /** Convert screen coordinates to world coordinates. */ |
| 40 | export function screenToWorld( |
| 41 | screenX: number, |
| 42 | screenY: number, |
| 43 | vp: Viewport, |
| 44 | ): { x: number; y: number } { |
| 45 | return { |
| 46 | x: (screenX - vp.x) / vp.scale, |
| 47 | y: (screenY - vp.y) / vp.scale, |
| 48 | }; |
| 49 | } |
| 50 | |
| 51 | /** Convert world coordinates to screen coordinates. */ |
| 52 | export function worldToScreen( |
no outgoing calls
no test coverage detected