fix editbox maxLength

This commit is contained in:
zilongshanren
2016-03-24 17:23:49 +08:00
parent b01f458217
commit 83c30ea536
3 changed files with 13 additions and 14 deletions
+3 -7
View File
@@ -420,14 +420,10 @@ var EditBox = cc.Class({
this._createBackgroundSprite();
if(this._useOriginalSize){
if(CC_EDITOR) {
this.node.setContentSize(sgNode.getContentSize());
}
if(this._useOriginalSize && CC_EDITOR){
this.node.setContentSize(sgNode.getContentSize());
this._useOriginalSize = false;
}
if(!this._useOriginalSize) {
} else {
sgNode.setContentSize(this.node.getContentSize());
}
+3 -7
View File
@@ -328,14 +328,10 @@ var Label = cc.Class({
sgNode.setLineHeight(this._lineHeight);
sgNode.setString(this.string);
sgNode.setFontFileOrFamily(this.file);
if(this._useOriginalSize){
if(CC_EDITOR) {
this.node.setContentSize(sgNode.getContentSize());
}
if(this._useOriginalSize && CC_EDITOR){
this.node.setContentSize(sgNode.getContentSize());
this._useOriginalSize = false;
}
if(!this._useOriginalSize) {
} else {
sgNode.setContentSize(this.node.getContentSize());
}
sgNode.setColor(this.node.color);
+7
View File
@@ -42,6 +42,13 @@ cc.defineGetterSetter(_p, 'delegate', null, _p.setDelegate);
cc.defineGetterSetter(_p, 'inputMode', null, _p.setInputMode);
cc.defineGetterSetter(_p, 'returnType', null, _p.setReturnType);
_p._setMaxLength = _p.setMaxLength;
_p.setMaxLength = function(maxLength) {
if (maxLength == -1) {
maxLength = Number.MAX_VALUE;
}
this._setMaxLength(maxLength);
}
_p.editBoxEditingDidBegin = function (sender) {
this.editBoxEditingDidBegan(sender);