mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-20 23:52:40 +08:00
fix layout reorder child issue.
Fix https://github.com/cocos-creator/fireball/issues/1935
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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();
|
||||
},
|
||||
|
||||
@@ -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,
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user