fix EditBox display err for fireball/issues/7445 (#2786)

This commit is contained in:
Knox
2018-06-04 18:39:12 +08:00
committed by pandamicro
parent d8ff99eb53
commit c27eed9b67
+4 -10
View File
@@ -454,8 +454,9 @@ let EditBox = cc.Class({
},
_showLabels () {
this._textLabel.node.active = true;
this._placeholderLabel.node.active = true;
let displayText = this._textLabel.string;
this._textLabel.node.active = displayText !== '';
this._placeholderLabel.node.active = displayText === '';
},
_hideLabels () {
@@ -468,14 +469,7 @@ let EditBox = cc.Class({
let textLabel = this._textLabel;
let displayText = text;
if (displayText === '') {
placeholderLabel.enabled = true;
textLabel.enabled = false;
}
else {
placeholderLabel.enabled = false;
textLabel.enabled = true;
if (displayText) {
displayText = this._updateLabelStringStyle(displayText);
}