mirror of
https://github.com/konvajs/konva.git
synced 2025-10-15 12:34:52 +08:00
fix #352 also did major remove and destroy refactoring, and added lots of unit and visual tests
This commit is contained in:
12
src/Node.js
12
src/Node.js
@@ -167,8 +167,9 @@
|
||||
if(parent && parent.children) {
|
||||
parent.children.splice(this.index, 1);
|
||||
parent._setChildrenIndices();
|
||||
delete this.parent;
|
||||
}
|
||||
delete this.parent;
|
||||
|
||||
return this;
|
||||
},
|
||||
/**
|
||||
@@ -179,20 +180,13 @@
|
||||
* node.destroy();
|
||||
*/
|
||||
destroy: function() {
|
||||
var children = this.children,
|
||||
go = Kinetic.Global;
|
||||
|
||||
// destroy children
|
||||
while(this.hasChildren() && children.length > 0) {
|
||||
children[0].destroy();
|
||||
}
|
||||
var go = Kinetic.Global;
|
||||
|
||||
// remove from ids and names hashes
|
||||
go._removeId(this.getId());
|
||||
go._removeName(this.getName(), this._id);
|
||||
|
||||
this.remove();
|
||||
return this;
|
||||
},
|
||||
/**
|
||||
* get attr
|
||||
|
Reference in New Issue
Block a user