mirror of
https://github.com/konvajs/konva.git
synced 2025-09-20 03:18:00 +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);
|
* node.moveTo(layer2);
|
||||||
*/
|
*/
|
||||||
moveTo: function(newContainer) {
|
moveTo: function(newContainer) {
|
||||||
Kinetic.Node.prototype.remove.call(this);
|
if (this.getParent() !== newContainer) {
|
||||||
newContainer.add(this);
|
this.remove();
|
||||||
|
newContainer.add(this);
|
||||||
|
}
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user