mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-20 23:52:40 +08:00
Merge pull request #356 from jareguo/master
improve conflict detection for widget and layout
This commit is contained in:
@@ -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;
|
||||
//}
|
||||
|
||||
//
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user