-
Suppose I have a component At first, I thought this would be as simple as Do you guys have any suggestions for how to achieve this? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
Edit: this was solved by #906 and Good idea! This should be pretty easy to implement. Right now you would have to do something like this: v.remove(x);
w.changePriorityWithoutResorting(x.priority);
// wait for next tick
x.shouldRemove = false;
w.addChild(x);
v.add(w); After #906 you could do this instead: w.changePriorityWithoutResorting(x.priority);
v.add(w);
x.changeParent(w); So with this suggestion it would be something like this? v.replaceChild(x, w, inheritPriority: true, inheritPosition: true ...);
w.add(x); |
Beta Was this translation helpful? Give feedback.
Edit: this was solved by #906 and
component.changeParent
Good idea! This should be pretty easy to implement.
With
replaceChild
I would expectW
to fully takeX
place in the tree though, and not wrapX
, but maybe that is what you meant with theW(X)
notation, thatX
is added toW
there already?I'm guessing we need quite a lot of optional parameters for the method too, since for a
PositionComponent
you might want it to take theposition
,size
,scale
orangle
of the component that it replaces too.Right now you would have to do something like this:
After #906 you…