Help, please: Group issue, they are a function for unGroup items in a Group

367 views
Skip to first unread message

Pere thinkink

unread,
May 10, 2013, 3:08:48 PM5/10/13
to pap...@googlegroups.com
I am unable to find a way to ungroup a group. I'm tired.

Someone can help me.

thank you very much in advance

rob

unread,
May 11, 2013, 12:06:34 AM5/11/13
to pap...@googlegroups.com
Just iterate over the children in the group and call remove () on each child

Jürg Lehni

unread,
May 11, 2013, 1:32:01 AM5/11/13
to pap...@googlegroups.com
That doesn't really work, since they would actually be removed from the DOM then.

Here is what you can do:


group.parent.addChildren(group.removeChildren());
group.remove();

I think it would make sense to add this to an ungroup function on Groups. Will think about it!

Jürg

On May 11, 2013, at 00:06 , rob <robert...@gmail.com> wrote:

> Just iterate over the children in the group and call remove () on each child
>
> --
> You received this message because you are subscribed to the Google Groups "Paper.js" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to paperjs+u...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Pere thinkink

unread,
May 11, 2013, 11:32:30 AM5/11/13
to pap...@googlegroups.com
Thanks Jürg, this works but when remove de group if any transformations are applied to this group. when the group is ungrouped the items lost transformations.

var from = new Point(180, 180);
var to = new Size(80, 80);
var path = new Path.Rectangle(from, to);
path.strokeColor = 'black';
path.scale(4)
var from = new Point(30, 40);
var to = new Point(120, 120);
var path2 = new Path.Rectangle(from, to);
path2.strokeColor = 'red';

 
alert("pause")
var group = new Group([path, path2]);
group.translate(view.center);
group.scale(2);

group.fillColor = 
    paper.project.view.draw();

alert("pause")

group.parent.addChildren(group.removeChildren()); 
        group.remove();

kostasvgt

unread,
Mar 28, 2016, 9:33:20 AM3/28/16
to Paper.js
Hi, I have the same problem, how can I safely ungroup in paperjs?
Thanks.

Jürg Lehni

unread,
Mar 28, 2016, 12:52:31 PM3/28/16
to pap...@googlegroups.com
I've just answered this on Github:


There is no direct functionality for this yet, but it would be good to add it. At the moment, you can do this:

    group.parent.insertChildren(group.index,  group.removeChildren());
    group.remove();

J

--
You received this message because you are subscribed to the Google Groups "Paper.js" group.
To unsubscribe from this group and stop receiving emails from it, send an email to paperjs+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages