MCPcopy Create free account
hub / github.com/Code-Bullet/Jump-King / getTouchInfo

Function getTouchInfo

libraries/p5.js:19381–19394  ·  view source on GitHub ↗
(canvas, w, h, e, i)

Source from the content-addressed store, hash-verified

19379
19380
19381function getTouchInfo(canvas, w, h, e, i) {
19382 i = i || 0;
19383 var rect = canvas.getBoundingClientRect();
19384 var sx = canvas.scrollWidth / w;
19385 var sy = canvas.scrollHeight / h;
19386 var touch = e.touches[i] || e.changedTouches[i];
19387 return {
19388 x: (touch.clientX - rect.left) / sx,
19389 y: (touch.clientY - rect.top) / sy,
19390 winX: touch.clientX,
19391 winY: touch.clientY,
19392 id: touch.identifier
19393 };
19394}
19395
19396/**
19397 * The touchStarted() function is called once after every time a touch is

Callers 1

p5.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected