You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
with originX/Y as Top/Left, you shouldn't have to subtract half of width/height to get the proper behavior.
note, that the correct behavior IS observed if the objects are added in the group constructor. in most of the live examples for the project, objects are only added to group via the constructor, never via group.add() after the group has been created. http://fabricjs.com/test/misc/grouporigin.html
The text was updated successfully, but these errors were encountered:
dmccuskey
changed the title
adding to group doesn't
adding to group doesn't obey originX/Y
Apr 9, 2017
Using addWithUpdate is better.
Add is just wrong in my opinion and should be removed.
Either create a group with the objects already passed as argument ( best ) of the app does not allow for this, just use addWithUpdate This will recalculate the group size every time, but gives better result.
Using the collection concept for both canvas and group, and sharing the add method has been a decision made when groups where created that now does not fit most of the group requirements.
Version
1.7.7 (jsfiddle), 1.7.9 (my project, npm install)
Test Case
https://jsfiddle.net/dmccuskey/0L9e32hx/
Steps to reproduce
see fiddle
Expected Behavior
i expect both canvases to look the same - both rectangles added to group should be group-origin aligned to Top / Left.
Actual Behavior
when using group.add(), inserted objects are not aligned with the container's originX/Y values. they are instead added at 'center', 'center'.
ps, this could be along the same vein as this bug report (ie, added objects aren't being correctly positioned) : #2073
the issue is also mentioned in this stack overflow: http://stackoverflow.com/questions/27358708/how-does-fabric-group-positioning-work
"i am not too sure why I have to subtract half of group width and height from group's left and top."
with originX/Y as Top/Left, you shouldn't have to subtract half of width/height to get the proper behavior.
note, that the correct behavior IS observed if the objects are added in the group constructor. in most of the live examples for the project, objects are only added to group via the constructor, never via group.add() after the group has been created. http://fabricjs.com/test/misc/grouporigin.html
The text was updated successfully, but these errors were encountered: