Why start drawing in different position from where I clicked

Good day

I used the code to draw spline on plane geometry but the drawing start from different position in which I clicked


I clicked on points A and the drawing start on point B I think the problem comes from mouse coordintes. how to fix thsi please?

the top of the canvas ≠ 0
and
the left

try

mouse.x = ((e.clientX - canvasLeft) / canvasWidth) * 2 - 1;
mouse.y = -((e.clientY - canvasTop) / canvasHeight) * 2 + 1;

Potential solution:

1 Like

Thank you solved :+1: