MCPcopy Create free account
hub / github.com/Vishal-raj-1/Awesome-JavaScript-Projects / getCanvasRelativePosition

Function getCanvasRelativePosition

assets/js/3DPaint.js:79–85  ·  view source on GitHub ↗
(event)

Source from the content-addressed store, hash-verified

77 requestAnimationFrame(render);
78
79 function getCanvasRelativePosition(event) {
80 const rect = canvas.getBoundingClientRect();
81 return {
82 x: ((event.clientX - rect.left) * canvas.width) / rect.width,
83 y: ((event.clientY - rect.top) * canvas.height) / rect.height,
84 };
85 }
86
87 const temp = new THREE.Vector3();
88 function setPosition(e) {

Callers 1

setPositionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected