fix node active in layout

This commit is contained in:
zilongshanren
2016-01-28 13:52:05 +08:00
parent a008a91135
commit 3726ce7f95
2 changed files with 10 additions and 0 deletions
+1
View File
@@ -261,6 +261,7 @@ var Node = cc.Class({
var canActiveInHierarchy = (this._parent && this._parent._activeInHierarchy);
if (canActiveInHierarchy) {
this._onActivatedInHierarchy(value);
this.emit('active-in-hierarchy-changed', this);
}
}
}
+9
View File
@@ -285,6 +285,7 @@ var Layout = cc.Class({
this.node.on('anchor-changed', this._doLayoutDirty, this);
this.node.on('child-added', this._childrenAddOrDeleted, this);
this.node.on('child-removed', this._childrenAddOrDeleted, this);
this._updateChildrenEventListener();
},
@@ -298,6 +299,7 @@ var Layout = cc.Class({
child.on('size-changed', this._doLayoutDirty, this);
child.on('position-changed', this._doLayoutDirty, this);
child.on('anchor-changed', this._doLayoutDirty, this);
child.on('active-in-hierarchy-changed', this._doLayoutDirty, this);
}.bind(this));
},
@@ -337,6 +339,9 @@ var Layout = cc.Class({
}
children.forEach(function(child) {
if (!child.activeInHierarchy) {
return;
}
//hacking for label
child.getContentSize();
//for resizing children
@@ -462,6 +467,10 @@ var Layout = cc.Class({
}
children.forEach(function(child) {
if (!child.activeInHierarchy) {
return;
}
//hacking for label
child.getContentSize();
//for resizing children