-
-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
line(a, b) vs lineTo([a, b]) argument types #41
Comments
This is the different between an absolute and a relative position. When you draw (or sketch) your pointer is at a position (for instance you drew a line to |
I should've been more explicit... Why are the arguments not the same types? Sorry 🥲 |
This tries to make explicit that these two actions are different. When you move absolutely you move to a point (i.e. an array of two numbers). When you move in relative you change distances (which is not a point). I concede that when you move relatively you move by a vector (which is also an array of numbers). Is there a reason you would prefer to have it as a vector? |
It's a more consistent API interface - when running svg2replicad I didn't realize this and was getting an error - it was because I presumed they were of the same type! It makes calling more consistent: line(x, y) vs lineTo(v) is inconsistent when they are both drawing lines... And there are probably cases for when you want to do math on the absolute point v that transforms it into a "relative point" v2 and vice-versa... The math then only involves 1 type, making everything easier to understand (instead of seeing additional type conversion) You could keep the old API for line and just provide it an overloaded type as well ( |
It feels like it would be less welcoming for new users. It makes the API more consistant - but the action behind it is not consistant. In some ways it exposes the inconsistency (
Note that the conversion is not that complicated to do There is a bit of inconsistency with the way I do the translate - sometimes I take a vector sometimes a list of distances. I will support everywhere the list of distances for consistency with the "what is absolute and what is relative". I will keep the type overloaded for backwards compatibility but might remove it at some point in the future. I will close this issue for now - if I see it coming up again and again with newbies I will reconsider! |
How come there's this difference?
The text was updated successfully, but these errors were encountered: