-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Clean origins #2257
Clean origins #2257
Conversation
wait one test missing. |
Merged similar code, avoid rotating point if the angle is 0. General code reduction. |
var degreesToRadians = fabric.util.degreesToRadians; | ||
var degreesToRadians = fabric.util.degreesToRadians, | ||
originXOffset = { | ||
left: -0.5, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are the only things that look confusing to me. Why -0.5, 0 and 0.5?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because we are always working with half width and half height to translate
the points.
i writing tests for all those functions to be sure they give same result as
old one.
Il 06/giu/2015 05:07, "Juriy Zaytsev" [email protected] ha
scritto:
In src/mixins/object_origin.mixin.js
#2257 (comment):@@ -1,40 +1,55 @@
(function() {
- var degreesToRadians = fabric.util.degreesToRadians;
- var degreesToRadians = fabric.util.degreesToRadians,
originXOffset = {
left: -0.5,
These are the only things that look confusing to me. Why -0.5, 0 and 0.5?
—
Reply to this email directly or view it on GitHub
https://github.com/kangax/fabric.js/pull/2257/files#r31863927.
@kangax they give same results in tests but are shorter, also they do not rotate point if there is no angle. |
@asturur you mean shorter in code? So you think this is OK to merge? |
i think yes. if you think code looks better and is worth ro skip rotation on angle 0, merge it. |
Note: i forgot 1 small optimization ( double calculation of sin and cos ) and to change this.getWidth() with this.getTransformedDimensions(). |
Changes Unknown when pulling b22ae4f on asturur:clean-origins into ** on kangax:master**. |
Cleaning of object origins code.
easier to add functions to switch from topleft, topcenter, bottomright and so on.
Necessary but not sufficietn to fix the pointer of rotated itext that is not top left (#2234)