Here’s a slightly more sensible approach to something like this:
zipped project:
vid: https://i.gyazo.com/c4d1e1d049689c73159f65c8717ac8c6.mp4
Leaving the area or right clicking stops drawing. Drawing of multiple separate lines is not included, here you continue drawing where you stopped last.