Button allow enableAutoGrayEffect when COLOR transition being choosed (#3026)

This commit is contained in:
Jare Guo
2018-07-31 10:37:45 +08:00
committed by pandamicro
parent 3845b740fc
commit 1abfe0c006
2 changed files with 8 additions and 7 deletions
+1 -1
View File
@@ -502,7 +502,7 @@ function _doDispatchEvent (owner, event) {
}
}
_cachedArray.length = 0;
};
}
/**
* !#en
+7 -6
View File
@@ -661,14 +661,15 @@ let Button = cc.Class({
_updateDisabledState () {
if (this._sprite) {
this._sprite.setState(cc.Sprite.State.NORMAL);
}
if (this.enableAutoGrayEffect && this.transition !== Transition.COLOR) {
if (!(this.transition === Transition.SPRITE && this.disabledSprite)) {
if (this._sprite && !this.interactable) {
this._sprite.setState(cc.Sprite.State.GRAY);
if (this.enableAutoGrayEffect) {
if (!(this.transition === Transition.SPRITE && this.disabledSprite)) {
if (!this.interactable) {
this._sprite.setState(cc.Sprite.State.GRAY);
return;
}
}
}
this._sprite.setState(cc.Sprite.State.NORMAL);
}
}
});