MetricSpinner: fix check auto value
This commit is contained in:
parent
7ae4da5f7e
commit
1ddd5b23d5
|
@ -234,10 +234,7 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
getNumberValue: function(){
|
getNumberValue: function(){
|
||||||
if (this.options.allowAuto && this.value==this.options.autoText)
|
return this.checkAutoText(this.value) ? -1 : parseFloat(this.value);
|
||||||
return -1;
|
|
||||||
else
|
|
||||||
return parseFloat(this.value);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
getUnitValue: function(){
|
getUnitValue: function(){
|
||||||
|
@ -262,7 +259,7 @@ define([
|
||||||
this.lastValue = this.value;
|
this.lastValue = this.value;
|
||||||
if ( typeof value === 'undefined' || value === ''){
|
if ( typeof value === 'undefined' || value === ''){
|
||||||
this.value = '';
|
this.value = '';
|
||||||
} else if (this.options.allowAuto && (Math.abs(Common.Utils.String.parseFloat(value)+1.)<0.0001 || value==this.options.autoText)) {
|
} else if (this.options.allowAuto && (Math.abs(Common.Utils.String.parseFloat(value)+1.)<0.0001 || this.checkAutoText(value))) {
|
||||||
this.value = this.options.autoText;
|
this.value = this.options.autoText;
|
||||||
} else {
|
} else {
|
||||||
var number = this._add(Common.Utils.String.parseFloat(value), 0, (this.options.allowDecimal) ? 3 : 0);
|
var number = this._add(Common.Utils.String.parseFloat(value), 0, (this.options.allowDecimal) ? 3 : 0);
|
||||||
|
@ -450,7 +447,7 @@ define([
|
||||||
val = this.getRawValue();
|
val = this.getRawValue();
|
||||||
val = _.isEmpty(val) ? me.oldValue : Common.Utils.String.parseFloat(val);
|
val = _.isEmpty(val) ? me.oldValue : Common.Utils.String.parseFloat(val);
|
||||||
} else if(me.getValue() !== '') {
|
} else if(me.getValue() !== '') {
|
||||||
if (me.options.allowAuto && me.getValue()==me.options.autoText) {
|
if (me.checkAutoText(me.getValue())) {
|
||||||
val = me.options.minValue-me.options.step;
|
val = me.options.minValue-me.options.step;
|
||||||
} else
|
} else
|
||||||
val = Common.Utils.String.parseFloat(me.getValue());
|
val = Common.Utils.String.parseFloat(me.getValue());
|
||||||
|
@ -471,7 +468,7 @@ define([
|
||||||
val = this.getRawValue();
|
val = this.getRawValue();
|
||||||
val = _.isEmpty(val) ? me.oldValue : Common.Utils.String.parseFloat(val);
|
val = _.isEmpty(val) ? me.oldValue : Common.Utils.String.parseFloat(val);
|
||||||
} else if(me.getValue() !== '') {
|
} else if(me.getValue() !== '') {
|
||||||
if (me.options.allowAuto && me.getValue()==me.options.autoText) {
|
if (me.checkAutoText(me.getValue())) {
|
||||||
val = me.options.minValue;
|
val = me.options.minValue;
|
||||||
} else
|
} else
|
||||||
val = Common.Utils.String.parseFloat(me.getValue());
|
val = Common.Utils.String.parseFloat(me.getValue());
|
||||||
|
@ -537,6 +534,14 @@ define([
|
||||||
v_out = parseFloat((v_out * 6.0 / 25.4).toFixed(6));
|
v_out = parseFloat((v_out * 6.0 / 25.4).toFixed(6));
|
||||||
|
|
||||||
return v_out;
|
return v_out;
|
||||||
|
},
|
||||||
|
|
||||||
|
checkAutoText: function(value) {
|
||||||
|
if (this.options.allowAuto && typeof value == 'string') {
|
||||||
|
var val = value.toLowerCase();
|
||||||
|
return (val==this.options.autoText.toLowerCase() || val=='auto');
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue