first phase of new attrs architecture to better represent Node states

This commit is contained in:
Eric Rowell
2012-04-05 23:48:58 -07:00
parent 15bd27562e
commit 6d618b97b5
15 changed files with 833 additions and 764 deletions

View File

@@ -44,8 +44,8 @@ Kinetic.Container.prototype = {
*/
_remove: function(child) {
if(this.children[child.index].id == child.id) {
if(child.name !== undefined) {
this.childrenNames[child.name] = undefined;
if(child.attrs.name !== undefined) {
this.childrenNames[child.attrs.name] = undefined;
}
this.children.splice(child.index, 1);
@@ -73,8 +73,8 @@ Kinetic.Container.prototype = {
* @param {Node} child
*/
_add: function(child) {
if(child.name) {
this.childrenNames[child.name] = child;
if(child.attrs.name) {
this.childrenNames[child.attrs.name] = child;
}
child.id = Kinetic.GlobalObject.idCounter++;
child.index = this.children.length;