steveruizok / perfect-freehand

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

Fix getStroke when there are multiple duplicates #18

Closed aaronsantiago closed 3 years ago

aaronsantiago commented 3 years ago

Using naive approaches to adding points, quite often we get hundreds of duplicates. Occasionally if duplicates happen in the correct sequence near the beginning of the points array, i would outpace the number of elements in strokePoints.

I'm unsure if there are better solutions to this but this change makes sense within the scope of the loop and fixes the problems in my project.

vercel[bot] commented 3 years ago

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/steveruiz/perfect-freehand-example/33wvC4wQE71wXpUkovTtLNqDaMq9
✅ Preview: https://perfect-freehand-example-git-fork-aaronsantiag-8c0ce9-steveruiz.vercel.app

steveruizok commented 3 years ago

Thanks! This is a great catch.