Pomax / bezierjs

A nodejs and client-side library for (cubic) Bezier curve work
MIT License
1.7k stars 230 forks source link

_lut caching doesn't work: steps is off by one #190

Closed justvanrossum closed 1 year ago

justvanrossum commented 1 year ago

Because of steps++ on line 248, the if (this._lut.length === steps) condition on line 243 always fails, as the lut will get a length of steps + 1:

https://github.com/Pomax/bezierjs/blob/d19695f3cc3ce383cf38ce4643f467deca7edb92/src/bezier.js#L240-L257

Perhaps move steps++ to before the condition?

Or change the condition to if (this._lut.length === steps + 1)?

I can make a PR if you want.

Pomax commented 1 year ago

Gah! good catch, let's make the check if (this._lut.length === steps + 1).

Pomax commented 1 year ago

v6.1.1 published to npm

justvanrossum commented 1 year ago

v6.1.1 published to npm

Thanks!

I think the dist/ folder needs updating, too. I wouldn't know how to contribute that, though.

Pomax commented 1 year ago

ah, forgot to run npm test =_=

I'll have to run that when I'm back at my computer.

Pomax commented 1 year ago

6.1.2 published >_>