fix editbox text vertical alignment

This commit is contained in:
zilongshanren
2016-03-24 21:27:26 +08:00
parent 83c30ea536
commit cc8957cfca
+2 -3
View File
@@ -250,9 +250,8 @@ EditBoxImpl.prototype = {
},
_updateLabelPosition: function (editBoxSize) {
var textLabelSize = this._textLabel.getContentSize();
this._placeholderLabel.setLineHeight(editBoxSize.height);
this._textLabel.setContentSize(editBoxSize);
this._placeholderLabel.setLineHeight(editBoxSize.height);
var placeholderLabelSize = this._placeholderLabel.getContentSize();
if (this._editBox._editBoxInputMode === InputMode.ANY){
@@ -264,7 +263,7 @@ EditBoxImpl.prototype = {
}
else {
this._textLabel.enableWrapText(false);
this._textLabel.setPosition(cc.p(0, (editBoxSize.height + textLabelSize.height) / 2));
this._textLabel.setPosition(cc.p(0, editBoxSize.height));
this._placeholderLabel.setPosition(cc.p(0, (editBoxSize.height + placeholderLabelSize.height) / 2));
this._placeholderLabel.setVerticalAlign(cc.VerticalTextAlignment.CENTER);
this._textLabel.setVerticalAlign(cc.VerticalTextAlignment.CENTER);