mirror of
https://github.com/konvajs/konva.git
synced 2025-09-19 10:47:59 +08:00
Kinetic.Node.moveTo() now checks if the node is already a child of the target container before removing it from the current container and adding it to the target container.
This commit is contained in:
@@ -1031,8 +1031,10 @@
|
||||
* node.moveTo(layer2);
|
||||
*/
|
||||
moveTo: function(newContainer) {
|
||||
Kinetic.Node.prototype.remove.call(this);
|
||||
newContainer.add(this);
|
||||
if (this.getParent() !== newContainer) {
|
||||
this.remove();
|
||||
newContainer.add(this);
|
||||
}
|
||||
return this;
|
||||
},
|
||||
/**
|
||||
|
Reference in New Issue
Block a user