steveruizok / perfect-freehand

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

[Bug] getStrokes returns NaN when provided two or more points with the same coordinates #29

Closed tarngerine closed 3 years ago

tarngerine commented 3 years ago
getStroke([
  [1, 1],
  [1, 1],
])

ends up with

image

this can happen when sampling points on each frame (as opposed to onmousemove)

im not sure what the best expected result is, maybe drawing the points as a single dot/circle? or return an empty array if any of the results are NaN

steveruizok commented 3 years ago

Good catch! Fixed in https://github.com/steveruizok/perfect-freehand/commit/629d7676258936730d13ecb767d00f79a9cd0e68