MCPcopy
hub / github.com/opentrace/opentrace / screenToWorld

Function screenToWorld

ui/src/components/pixi/viewport.ts:40–49  ·  view source on GitHub ↗
(
  screenX: number,
  screenY: number,
  vp: Viewport,
)

Source from the content-addressed store, hash-verified

38
39/** Convert screen coordinates to world coordinates. */
40export 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. */
52export function worldToScreen(

Callers 2

setupInteractionMethod · 0.90
pointerUpMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected