openfl / svg

Provides SVG parsing and rendering for OpenFL and Haxe
MIT License
68 stars 30 forks source link

Rotation support. Fixes #41 #42

Closed ashes999 closed 8 years ago

ashes999 commented 8 years ago

Please review the untranslate/retranslate code. I hope I got my algebra right (it's been a while ...)

ashes999 commented 8 years ago

Code review please? @jcward @gama11

jcward commented 8 years ago

Looks good to me.

ashes999 commented 8 years ago

Please review @ibilon

ashes999 commented 8 years ago

Looks like I merged this in by mistake. It still needs a review.

ibilon commented 8 years ago

According to https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/transform rotate(<a> [<x> <y>]) is equivalent to translate(<x>, <y>) rotate(<a>) translate(-<x>, -<y>) but here the translate are in the other order.

Also the x,y parameters should be optional, "If optional parameters x and y are not supplied, the rotate is about the origin of the current user coordinate system."

ashes999 commented 8 years ago

I'll take a look at this next week.

Sorry to get the formula wrong. I reverse-engineered it (didn't think the SVG spec would mention it) from highschool algebra (move to origin, rotate, and move back).