Closed nichoth closed 5 months ago
@nichoth thanks for catching this one, too! It didn't occur to me to try double clicking :P i'll merge this now
@nichoth Just to add some context, it turns out the culprit with both issues you found, was that I originally covered for cases where previous X/Y is 0 in pointerMove but didn't do so in pointerUp.
Looking at your fix, I realised that correcting for when prevX/Y == 0 should be done inside the draw
method itself. This does have the unfortunate side effect, that drawing a line from exactly (0,0) to any arbitrary (x,y) is not possible. However, in practice I think it's unlikely to impact users, because it's usually very hard to click exactly on (0,0), and even if the user does, only the first line segment will be missed. I think that's an acceptable tradeoff.
Another option would be to set previous X/Y to null
when the stroke ends, rather than 0. I remember thinking about this some months ago and there was a reason I didn't end up doing it, if only I could remember :D
In any case, thank you for flagging up these issues. Atrament v4.4.0 is now published with your fix, I hope you enjoy using the library :)
Cool thank you. I noticed that also, that starting at 0,0 was impossible, but thought it would basically never happen in practice, so an ok solution.
I don't know the details of how the algorithm works, but this fixes the issue.