timjs / elm-collage

Create interactive vector graphics and position them relative to each other
BSD 3-Clause "New" or "Revised" License
58 stars 19 forks source link

add scaleX and scaleY #3

Closed danfishgold closed 6 years ago

danfishgold commented 6 years ago

I saw the TODO where you wanted to give them cooler names, but I think these names are less confusing and more in line with Elm GraphicSVG and Elm Graphics.

I implemented this with a tuple scale : (Float, Float), but it could have been done with a record. I'm not sure which is better.

timjs commented 6 years ago

Thanks for the pull request @danfishgold, your code looks great! I think a tuple is the best way to go here.

Two questions:

danfishgold commented 6 years ago

skewX and skewY are the names used in svg (and css) transforms. People who are familiar with this will know what these functions mean, and beginners will have an easier time Googling for help. Also, as a non-native English speaker, I don't know the difference between skew, tilt, and slant so I prefer to explicitly state the axis.

I don't have as strong a case for scale, but if there's skewX and skewY, I think there should be scaleX and scaleY. If you still prefer nicer names I don't think lengthen is a good fit because there are cases where it might be ambiguous: lengthening a rectangle (or a bus, or a snake) means increasing its longer side, which isn't necessarily along the Y axis.

timjs commented 6 years ago

You totally convinced me! Especially that function names will be easily recognised is a big plus.

Thanks for changing the docs, can you make a small example? Then I'll merge your request.

Kwarrtz commented 6 years ago

I'm a little late to the party, but I think it's worth pointing out that words like lengthen and broaden tend to suggest an increase in size (i.e. a scale factor of greater than 1), which is not desirable here. scale and skew also have the bonus of being familiar to those with backgrounds in linear algebra.

timjs commented 6 years ago

Even more reasons to use scaleX/Y and skewX/Y instead of fancy names!

Thanks for your opinion @Kwarrtz.

danfishgold commented 6 years ago

I can't think of a basic example for scaleX and scaleY because for simple stuff you can use rectangles instead of squares and ellipses instead of circles 😅

timjs commented 6 years ago

I'll think of something :wink: