fix layout reorder child issue.

Fix https://github.com/cocos-creator/fireball/issues/1935
This commit is contained in:
zilongshanren
2016-02-17 16:37:21 +08:00
parent ec2d4db718
commit 14b51b2ef6
4 changed files with 9 additions and 2 deletions
+4
View File
@@ -1178,6 +1178,10 @@ if (cc.sys.isNative) {
* @param {cc.Event} event
* @param {cc.Node} event.detail - child
*/
/**
* @event child-reorder
* @param {cc.Event} event
*/
/**
* Note: This event is only emitted from the top most node whose active value did changed,
* not including its child nodes.
+1
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.node.on('child-reorder', this._doLayoutDirty, this);
this._updateChildrenEventListener();
},
+2 -2
View File
@@ -764,7 +764,7 @@ var fillQuadGeneratorRadial = {
var yleft = center.y + tanAngle * (left - center.x);
if(yleft > bottom && yleft < top) {
intersectPoints[0] = intersectPoints[4];
intersectPoints[5] = null;
intersectPoints[4] = null;
intersectPoints[0].x = left;
intersectPoints[0].y = yleft;
}
@@ -1319,4 +1319,4 @@ cc.Scale9Sprite.FillType = cc.Enum({
Vertical: 1,
//todo implement this
RADIAL:2,
});
});
+2
View File
@@ -48,6 +48,7 @@ var COLOR_CHANGED = 'color-changed';
var OPACITY_CHANGED = 'opacity-changed';
var CHILD_ADDED = 'child-added';
var CHILD_REMOVED = 'child-removed';
var CHILD_REORDER = 'child-reorder';
var ERR_INVALID_NUMBER = CC_EDITOR && 'The %s is invalid';
@@ -1364,6 +1365,7 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{
if (cc.renderer) {
cc.renderer.childrenOrderDirty = this._parent._sgNode._reorderChildDirty = true;
}
this._parent.emit(CHILD_REORDER);
}
},