jakubfiala / atrament

A small JS library for beautiful drawing and handwriting on the HTML Canvas.
http://fiala.space/atrament/demo
MIT License
1.55k stars 116 forks source link

Sometimes drawing adds a line between beginning and end of stroke #67

Closed uriberto closed 3 years ago

uriberto commented 3 years ago

I can't seem to figure out what is causing this, as it doesn't always happen. Sometimes when I draw on the canvas, when I let the mouse up, I get an extra straight line from the end point of the stroke to the beginning point of the stroke. I'm not 100% sure it's a bug. I could have implemented atrament wrong, but I can't seem to find it. Also, it's not saving that extra line to the stroke because if I hit "undo", it removes all of the extra lines from however many past strokes have had it.

Any help would be very appreciated. TIA

https://user-images.githubusercontent.com/39074364/114517894-639d7d80-9c04-11eb-9e13-1a591bbb74c8.mov atramentfunctions.txt

uriberto commented 3 years ago

Sorry to have posted too early. I seem to have figured it out. In resizing canvas on window size change, I was re-initializing the sketchpad. So, I already had called sketchpad = new Atrament(canvas), and then called it again. I'm not sure why that caused this particular behavior, but it did.