Closed natfarleydev closed 6 years ago
I'm slowly refactoring all the routines inherited from drow to eliminate those single letter variables and try to document some of what's going on. I welcome all help in this area :)
Excellent! How can I help?
My vague plan was to document everything so it's easy to understand what the code is achieving and then maybe build some tests in order to refactor?
This PR can be merged immediately, I'm happy to reopen new ones as I document more.
As far as refactoring goes, it's not radical: I'm using Visual Studio to rename variables (thank you Visual Studio). Giving them sensible names requires tracing what the heck everything is and sometimes that requires going all the way up and down the call stack. Documenting the functions will help assign sensible names, so anywhere you can do that (either function arguments or internal variables) will help.
I'm also targetting the re-used variables, I can't stand that (particularly when combined with obscure variable names).
Sounds good to me! I'll focus on pure documentation for now as without tests I'm not sure I trust VS Code's renaming variables without understanding how the JS code works (esp. with the shadowing/reusing of variables)
This PR adds docs to functions in canvas.js
I plan to make more documentation (since I want to actively develop, but single letter varnames make it difficult) but figured there's no harm in pull requesting as I go.
This PR also includes one small change to
fmt_color
function which is nowfmt_color(r, g, b)
instead offmt_color(a, c, b)
.Any comments/suggestions/improvements are welcome.