-
-
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
fix(v6): 4th PR of Group Rewrite ποΈ nested controls π #7861
Conversation
in case object is a collection
Continue there, I'll patch up what you've suggested later on. |
I try to avoid multiple checks for the same conditions. |
I dislike nesting logic, I prefer it flat as possible |
fair enough. this is excellent by the way π |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Code Coverage Summary
|
Catching up with this. |
Some logic is leaking between PRs. this belongs to #7861
src/mixins/object_geometry.mixin.js
Outdated
return util.calcRotateMatrix(this); | ||
_calcRotateMatrix: function (absolute, accountForFlipping) { | ||
var angle = absolute ? this.getTotalAngle() : this.angle; | ||
accountForFlipping && this.flipX && (angle -= 180); |
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.
i wonder how nested flippings behave.
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.
I wonder/forgot why I accounted for flipX
only for nested objects, why not for all objects?
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.
It's bad. Good catch.
Isn't flipX/flipY a z plane transformation? If so wouldn't it be better to multiply 3d matrices?
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.
rotation as used by fabric is a 2d plane transformation. So it shouldn't relate to z plane transformations. I think this is the cause of the problem (in all flipX/Y logic)
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.
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.
@asturur Thoughts?
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.
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.
I guess we can use matrix projection from 3d -> 2d...
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.
But it opens up 3d and I'm not sure we want that.
So I vote to remove flip props as they are broken
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.
Code Coverage Summary
|
var vpt = this.getViewportTransform(), | ||
center = this.getCenterPoint(), | ||
tMatrix = [1, 0, 0, 1, center.x, center.y], | ||
rMatrix = util.calcRotateMatrix({ angle: this.getTotalAngle() - (!!this.group && this.flipX ? 180 : 0) }), | ||
positionMatrix = multiplyMatrices(tMatrix, rMatrix), | ||
startMatrix = multiplyMatrices(vpt, positionMatrix), | ||
finalMatrix = multiplyMatrices(startMatrix, [1 / vpt[0], 0, 0, 1 / vpt[3], 0, 0]), | ||
transformOptions = this.group ? fabric.util.qrDecompose(this.calcTransformMatrix()) : undefined, | ||
dim = this._calculateCurrentDimensions(transformOptions), |
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.
Just to be clear, i m sure there are bugs with angle compensation but is not important. This PR improves the situation anyway.
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.
(!!this.group && this.flipX ? 180 : 0)
I can't imagine this is good enough for sure.
For the reader of the future. |
π¨ I see it as a bug in qrDecompose. Fixing it means moving to 3d transformation matrix or dropping flipX/Y for good (I think that's not a bad idea - very strange feature) For the reader of the future - We are sorry this is how it is. STAY AWAY from |
flipX and flipY are totally normal, and are just an abstraction for a negative scale that is totally normal too. is like when you get a 6, was it 3 x 2 or 6 x 1? you can't know. I m not sure a different matrix would help, unless rotation and scale occupy different cells in the matrix. [scaleX * cosA] [ -sinA ] [translateX] idependently from the fact that the mulitplication between trasnformation make everything even more complicated, the biggest lie is in the fact that the position 'a' and 'd' of the transform matrix are occupied by scale ( and so flip ) and a part of the rotation. with the cosine that can be negative or positive and the scale too, once you have those multipled together, if you decompose a matrix without knowing how the object ( and the parents ) are flipped or not flipped, you can't get out of it. |
Is it negative scale or 180deg rotation around the x/y axis? Or are the 2 cases the same thing?
Confusing indeed. However the characteristic polynomial might serve as an answer in this case (not sure about it though) 'cause if a matrix is multiplied by a rotation matrix it doesn't have a solution for the characteristic polynomial. Meaning that we can check to see if there is a solution and if so we know the angle was 0. And I read about extracting a rotation matrix be it's heavy stuff. Did you look at Apart from qr decomposition we can do something with eigenvalues that might help determine the rotation... I really don't know enough linear algebra to solve this.
Yes, Is true. |
This PR fixes control rendering.
There are a few unresolved comments in the original PR, please take a look.
Main Changes
commit
This PR ports #7758 to master
Visuals
controls12.png
controls13.png