steveruizok / perfect-freehand

Draw perfect pressure-sensitive freehand lines.
https://perfectfreehand.com
MIT License
4.52k stars 159 forks source link

fix: Backtracking now doesn't create dots at end of lines #54

Closed TodePond closed 2 years ago

TodePond commented 2 years ago

See: https://github.com/steveruizok/perfect-freehand/issues/48

This fixes a bug where sharp corners would sometimes cause a "dot" to appear at the end of a line. The bug happened because some sharp corners were not getting detected. To detect them, I made it also check the dot-product of the current point and previous point (not just the next point). Maybe a cleaner fix here, but maybe it can solve it for now.

Line 212 and 213 could be better - I made them kinda messy to avoid typescript complaining but there's probably a better way of structuring it?

vercel[bot] commented 2 years ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
perfect-freehand-example ✅ Ready (Inspect) Visit Preview Aug 22, 2022 at 3:17PM (UTC)
pf-dev ✅ Ready (Inspect) Visit Preview Aug 22, 2022 at 3:17PM (UTC)
steveruizok commented 2 years ago

Works for me!