MCPcopy Create free account
hub / github.com/DeepNotesApp/DeepNotes / displayToWorld

Method displayToWorld

apps/client/src/code/pages/page/space/pos.ts:40–49  ·  view source on GitHub ↗
(displayPos: Vec2)

Source from the content-addressed store, hash-verified

38 }
39
40 displayToWorld(displayPos: Vec2): Vec2 {
41 const displayRect = this.rects.fromDisplay();
42
43 return new Vec2(
44 this.camera.react.pos.x +
45 (displayPos.x - displayRect.size.x / 2) / this.camera.react.zoom,
46 this.camera.react.pos.y +
47 (displayPos.y - displayRect.size.y / 2) / this.camera.react.zoom,
48 );
49 }
50 worldToDisplay(worldPos: Vec2): Vec2 {
51 const displayRect = this.rects.fromDisplay();
52

Callers 2

clientToWorldMethod · 0.95
PagePinchingClass · 0.45

Calls 1

fromDisplayMethod · 0.80

Tested by

no test coverage detected