-
-
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
ungroupOnCanvas does not ungroup and does not restore object state correctly. #6315
Comments
I have never used a group (besides http://fabricjs.com/fabric-intro-part-3#groups BTW to create and expand an |
Well, the functionality does not follow what the docs says either, so ether the bug is in the docs, or in the functionality : ) Edit: And the ungroupOnCanvas is not mentioned in the tutorial at all, so there is no way to know for certain how to use that function. Edit2: Actually the tutorial does not at all mention how to get rid of groups. |
my memory is short on what
ActiveSelection.toGroup and Group.toActiveSelection are supposed to work on with the other. |
unGroupOnCanvas seems something that was created ( 3 years ago ) never used elsewhere, maybe thought of being fo public utility but i do not think it is. I think i should delete it in the beta of version 4 and just put it as a breaking change. And by the way unGroupOnCanvas just call _restoreObjectsState Does it even work? |
With some distance: |
Yes, i have seen that example also and "toActiveSelection" was the first thing i tried. For actual user ungrouping i use "toActiveSelection". But using "toActiveSelection" made stuff move around on the canvas unexpectedly when it was part of a selection and i did not get it to work correctly, thats why i looked for an alternative way on ungrouping. |
Yes, might be best to just remove it. I might have to try again to get it to work with the "toActiveSelection" instead, even though it works fine now with "unGroupOnCanvas" when manually removing the group afterwards. |
So you are looking that is like |
Yes, that exactly what im trying to do. Saving the state is just to bothersome when its stacked : p |
Ok, finally managed to get it to work: I guess this issue can be closed now then if "unGroupOnCanvas" is going to get removed anyways : ) |
Version
3.6.3
Test Case
https://jsfiddle.net/Lmxb9qdu/3/
Information about environment
Firefox, Chrome
Steps to reproduce
Run fiddle, select both boxes and press "Group" button, then press "Ungroup" button and click on canvas to get rid of selection.
Expected Behavior
I expect what the docs says: "Destroys a group (restoring state of its objects) ".
That the group gets destroyed and the objects are restored.
Actual Behavior
Group is not destroyed at all, and the objects changes their position.
One way of working around this is to make sure the selection is removed first, and then destroy the group manually. This seems to get the expected behavior (imo):
canvas.discardActiveObject()
object.ungroupOnCanvas()
canvas.remove object
The text was updated successfully, but these errors were encountered: