Skip to content

Commit

Permalink
add scale calculate in layout when child scale changed (cocos#3467)
Browse files Browse the repository at this point in the history
  • Loading branch information
ColinCollins authored and jareguo committed Dec 19, 2018
1 parent fcfd62d commit 8baf506
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cocos2d/core/components/CCLayout.js
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,7 @@ var Layout = cc.Class({
child.on(NodeEvent.SIZE_CHANGED, this._doLayoutDirty, this);
child.on(NodeEvent.POSITION_CHANGED, this._doLayoutDirty, this);
child.on(NodeEvent.ANCHOR_CHANGED, this._doLayoutDirty, this);
child.on(NodeEvent.SCALE_CHANGED, this._doLayoutDirty, this);
child.on('active-in-hierarchy-changed', this._doLayoutDirty, this);
}
},
Expand All @@ -473,6 +474,7 @@ var Layout = cc.Class({
child.off(NodeEvent.SIZE_CHANGED, this._doLayoutDirty, this);
child.off(NodeEvent.POSITION_CHANGED, this._doLayoutDirty, this);
child.off(NodeEvent.ANCHOR_CHANGED, this._doLayoutDirty, this);
child.off(NodeEvent.SCALE_CHANGED, this._doLayoutDirty, this);
child.off('active-in-hierarchy-changed', this._doLayoutDirty, this);
}
},
Expand All @@ -481,6 +483,7 @@ var Layout = cc.Class({
child.on(NodeEvent.SIZE_CHANGED, this._doLayoutDirty, this);
child.on(NodeEvent.POSITION_CHANGED, this._doLayoutDirty, this);
child.on(NodeEvent.ANCHOR_CHANGED, this._doLayoutDirty, this);
child.on(NodeEvent.SCALE_CHANGED, this._doLayoutDirty, this);
child.on('active-in-hierarchy-changed', this._doLayoutDirty, this);

this._doLayoutDirty();
Expand All @@ -490,6 +493,7 @@ var Layout = cc.Class({
child.off(NodeEvent.SIZE_CHANGED, this._doLayoutDirty, this);
child.off(NodeEvent.POSITION_CHANGED, this._doLayoutDirty, this);
child.off(NodeEvent.ANCHOR_CHANGED, this._doLayoutDirty, this);
child.off(NodeEvent.SCALE_CHANGED, this._doLayoutDirty, this);
child.off('active-in-hierarchy-changed', this._doLayoutDirty, this);

this._doLayoutDirty();
Expand Down

0 comments on commit 8baf506

Please sign in to comment.