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
var canvas = new fabric.Canvas('viewport');
var text1 = new fabric.IText('Text1', {
left: 0,
top: 0
});
var text2 = new fabric.IText('Text2', {
left: 0,
top: 125
});
var group = new fabric.Group([text1, text2], {
left: 150,
top: 100
});
canvas.add(group);
document.getElementById('ungroup').addEventListener('click' ,function ungroup() {
var destroyedGroup = group.destroy();
var items = destroyedGroup.getObjects();
items.forEach(function (item) {
canvas.add(item);
});
canvas.remove(group);
});
The destroy calls the _restoreObjectsState which seems to try to restore the position, but as soon as I put an item in a group the top and left becomes negative. so the _restoreObjectsState is never able restore them properly.
Is there any good solution to ungroup items but keep their position on the document ?
Thanks for your help
The text was updated successfully, but these errors were encountered:
With updated fabricJs it does not happen on first press.
Later yes.
I don't know if this is code fault or library bug.
But you should use the one currently in the github ( 1.4.12+) it had some group fixing recently
Thanks a lot. I was using 1.4.12, but for some reason the file included in dist/ from master dose not work but the one you linked in the jsfiddle does work. So I guess I need to build it ?
1.4.0 is the latest stable, but many bugs have been found and solved, even if github is fresh code in worst scenario you have different bugs than before, but probably you have lot less.
I currently want to incorporate some sort of "group" edit mode im my application but when I ungroup items I can never restore the proper positions.
here is the js fiddle:
http://jsfiddle.net/vq3Lj0th/5/
The destroy calls the _restoreObjectsState which seems to try to restore the position, but as soon as I put an item in a group the top and left becomes negative. so the _restoreObjectsState is never able restore them properly.
Is there any good solution to ungroup items but keep their position on the document ?
Thanks for your help
The text was updated successfully, but these errors were encountered: