mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-21 16:12:40 +08:00
fix node active in layout
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user