Merge pull request #356 from jareguo/master

improve conflict detection for widget and layout
This commit is contained in:
Jare Guo
2016-02-21 20:45:39 +08:00
3 changed files with 32 additions and 6 deletions
+5 -5
View File
@@ -551,11 +551,11 @@ var Node = cc.Class({
}
}
// check conflict
if (CC_EDITOR && !_Scene.DetectConflict.beforeAddComponent(this, constructor)) {
return null;
}
//// check conflict
//
//if (CC_EDITOR && !_Scene.DetectConflict.beforeAddComponent(this, constructor)) {
// return null;
//}
//
+19 -1
View File
@@ -143,6 +143,12 @@ var Layout = cc.Class({
default: Type.NONE,
type: Type,
notify: function() {
if (this.layoutType !== Type.NONE && this._resize === ResizeType.CONTAINER && CC_EDITOR && !cc.engine.isPlaying) {
var reLayouted = _Scene.DetectConflict.checkConflict_Layout(this);
if (reLayouted) {
return;
}
}
this._doLayoutDirty();
},
animatable: false,
@@ -168,8 +174,14 @@ var Layout = cc.Class({
return;
}
this._doLayoutDirty();
this._resize = value;
if (this.layoutType !== Type.NONE && value === ResizeType.CONTAINER && CC_EDITOR && !cc.engine.isPlaying) {
var reLayouted = _Scene.DetectConflict.checkConflict_Layout(this);
if (reLayouted) {
return;
}
}
this._doLayoutDirty();
},
animatable: false
},
@@ -197,6 +209,12 @@ var Layout = cc.Class({
default: AxisDirection.HORIZONTAL,
type: AxisDirection,
notify: function() {
if (this._resize === ResizeType.CONTAINER && CC_EDITOR && !cc.engine.isPlaying) {
var reLayouted = _Scene.DetectConflict.checkConflict_Layout(this);
if (reLayouted) {
return;
}
}
this._doLayoutDirty();
},
animatable: false
+8
View File
@@ -392,6 +392,10 @@ var Widget = cc.Class({
if (this.isStretchWidth) {
// become stretch
this._originalWidth = this.node.width;
// test check conflict
if (CC_EDITOR && !cc.engine.isPlaying) {
_Scene.DetectConflict.checkConflict_Widget(this);
}
}
}
else {
@@ -399,6 +403,10 @@ var Widget = cc.Class({
if (this.isStretchHeight) {
// become stretch
this._originalHeight = this.node.height;
// test check conflict
if (CC_EDITOR && !cc.engine.isPlaying) {
_Scene.DetectConflict.checkConflict_Widget(this);
}
}
}