Help with figuring out the right transformation of vertices on R3F

Hi all! I’ve been facing an issue with the way vertices are calculated within my R3F scene.

I’m trying to move forward with an implementation where I would be drawing a line whenever I’m clicking the scene, to later have it follow my cursor, increasing its size.

I can do that without any weird behaviour if I start my line on the coordinates (0,0), as shown on the first screenshot.

Whenever I start my line on coordinates besides (0,0), the line does not properly follow my cursor.

Here is a Codesanbox with the exact code, including where I calculate the vertices positions on editLine function.