Fix static p5 vector method#8998
Conversation
|
🎉 Thanks for opening this pull request! For guidance on contributing, check out our contributor guidelines and other resources for contributors! Thank You! |
|
@ksen0 thnks ... |
Continuous ReleaseCDN linkPublished PackagesCommit hash: e09e6f7 Previous deploymentsThis is an automated message. |
| Vector._friendlyError = p5._friendlyError; | ||
| Vector.friendlyErrorsDisabled = function() { | ||
| return p5.disableFriendlyErrors; | ||
| }; |
There was a problem hiding this comment.
Here we are defining the fes in the vector class and here p5._firendlyError is a global static.
What if we don't do this and everywhere in this file wherever this._friendlyError is called we replace it with p5._friendlyError it should work the same and could look a little cleaner?
It's similar to how setHeading() is in this file (line no. 2028)?
what you think?
Resolves #8930
Changes:
In
src/math/p5.Vector.js:- Properlybound _friendlyError&friendlyErrorsDisabledto the static Vector. Added earlyfalseafter the friendly error is triggered. This prevents a secondary crash.Added a new unit test suite to ensure the static FES validation works.
Screenshots of the change:

PR Checklist
npm run lintpasses