mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-21 08:02:39 +08:00
fix editbox maxLength
This commit is contained in:
@@ -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());
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user