Fix Bug 44916

This commit is contained in:
Julia Radzhabova 2020-03-31 16:49:33 +03:00
parent 644c8f2bd2
commit 308428d83f
14 changed files with 28 additions and 23 deletions

View file

@ -262,10 +262,10 @@ 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(parseFloat(value)+1.)<0.0001 || value==this.options.autoText)) { } else if (this.options.allowAuto && (Math.abs(Common.Utils.String.parseFloat(value)+1.)<0.0001 || value==this.options.autoText)) {
this.value = this.options.autoText; this.value = this.options.autoText;
} else { } else {
var number = this._add(parseFloat(value), 0, (this.options.allowDecimal) ? 3 : 0); var number = this._add(Common.Utils.String.parseFloat(value), 0, (this.options.allowDecimal) ? 3 : 0);
if ( typeof value === 'undefined' || isNaN(number)) { if ( typeof value === 'undefined' || isNaN(number)) {
number = this.oldValue; number = this.oldValue;
showError = true; showError = true;
@ -448,12 +448,12 @@ define([
var val = me.options.step; var val = me.options.step;
if (me._fromKeyDown) { if (me._fromKeyDown) {
val = this.getRawValue(); val = this.getRawValue();
val = _.isEmpty(val) ? me.oldValue : 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.options.allowAuto && me.getValue()==me.options.autoText) {
val = me.options.minValue-me.options.step; val = me.options.minValue-me.options.step;
} else } else
val = parseFloat(me.getValue()); val = Common.Utils.String.parseFloat(me.getValue());
if (isNaN(val)) if (isNaN(val))
val = this.oldValue; val = this.oldValue;
} else { } else {
@ -469,12 +469,12 @@ define([
var val = me.options.step; var val = me.options.step;
if (me._fromKeyDown) { if (me._fromKeyDown) {
val = this.getRawValue(); val = this.getRawValue();
val = _.isEmpty(val) ? me.oldValue : 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.options.allowAuto && me.getValue()==me.options.autoText) {
val = me.options.minValue; val = me.options.minValue;
} else } else
val = parseFloat(me.getValue()); val = Common.Utils.String.parseFloat(me.getValue());
if (isNaN(val)) if (isNaN(val))
val = this.oldValue; val = this.oldValue;

View file

@ -585,6 +585,11 @@ Common.Utils.String = new (function() {
} }
return Common.Utils.String.format(template, string); return Common.Utils.String.format(template, string);
},
parseFloat: function(string) {
(typeof string === 'string') && (string = string.replace(',', '.'));
return parseFloat(string)
} }
} }
})(); })();

View file

@ -1284,7 +1284,7 @@ define([
}); });
if (!item) { if (!item) {
value = /^\+?(\d*\.?\d+)$|^\+?(\d+\.?\d*)$/.exec(record.value); value = /^\+?(\d*(\.|,)?\d+)$|^\+?(\d+(\.|,)?\d*)$/.exec(record.value);
if (!value) { if (!value) {
value = this._getApiTextSize(); value = this._getApiTextSize();
@ -1305,7 +1305,7 @@ define([
} }
} }
} else { } else {
value = parseFloat(record.value); value = Common.Utils.String.parseFloat(record.value);
value = value > 100 value = value > 100
? 100 ? 100
: value < 1 : value < 1

View file

@ -572,7 +572,7 @@ define([
.on('changed:after', _.bind(function(combo, record) { .on('changed:after', _.bind(function(combo, record) {
if (me._changedProps) { if (me._changedProps) {
me._changedProps.put_XAlign(undefined); me._changedProps.put_XAlign(undefined);
me._changedProps.put_X(Common.Utils.Metric.fnRecalcToMM(parseFloat(record.value))); me._changedProps.put_X(Common.Utils.Metric.fnRecalcToMM(Common.Utils.String.parseFloat(record.value)));
} }
}, me)) }, me))
.on('selected', _.bind(function(combo, record) { .on('selected', _.bind(function(combo, record) {
@ -615,7 +615,7 @@ define([
.on('changed:after', _.bind(function(combo, record) { .on('changed:after', _.bind(function(combo, record) {
if (me._changedProps) { if (me._changedProps) {
me._changedProps.put_YAlign(undefined); me._changedProps.put_YAlign(undefined);
me._changedProps.put_Y(Common.Utils.Metric.fnRecalcToMM(parseFloat(record.value))); me._changedProps.put_Y(Common.Utils.Metric.fnRecalcToMM(Common.Utils.String.parseFloat(record.value)));
} }
}, me)) }, me))
.on('selected', _.bind(function(combo, record) { .on('selected', _.bind(function(combo, record) {

View file

@ -567,7 +567,7 @@ define([
}, },
applyBorderSize: function(value) { applyBorderSize: function(value) {
value = parseFloat(value); value = Common.Utils.String.parseFloat(value);
value = isNaN(value) ? 0 : Math.max(0, Math.min(1584, value)); value = isNaN(value) ? 0 : Math.max(0, Math.min(1584, value));
this.BorderSize = value; this.BorderSize = value;

View file

@ -436,7 +436,7 @@ define([
}, },
applyBorderSize: function(value) { applyBorderSize: function(value) {
value = parseFloat(value); value = Common.Utils.String.parseFloat(value);
value = isNaN(value) ? 0 : Math.max(0, Math.min(1584, value)); value = isNaN(value) ? 0 : Math.max(0, Math.min(1584, value));
this.BorderSize = value; this.BorderSize = value;

View file

@ -1206,7 +1206,7 @@ define([
}); });
if (!item) { if (!item) {
value = /^\+?(\d*\.?\d+)$|^\+?(\d+\.?\d*)$/.exec(record.value); value = /^\+?(\d*(\.|,).?\d+)$|^\+?(\d+(\.|,)?\d*)$/.exec(record.value);
if (!value) { if (!value) {
value = this._getApiTextSize(); value = this._getApiTextSize();
@ -1227,7 +1227,7 @@ define([
} }
} }
} else { } else {
value = parseFloat(record.value); value = Common.Utils.String.parseFloat(record.value);
value = value > 300 ? 300 : value = value > 300 ? 300 :
value < 1 ? 1 : Math.floor((value+0.4)*2)/2; value < 1 ? 1 : Math.floor((value+0.4)*2)/2;

View file

@ -547,7 +547,7 @@ define([
}, },
applyBorderSize: function(value) { applyBorderSize: function(value) {
value = parseFloat(value); value = Common.Utils.String.parseFloat(value);
value = isNaN(value) ? 0 : Math.max(0, Math.min(1584, value)); value = isNaN(value) ? 0 : Math.max(0, Math.min(1584, value));
this.BorderSize = value; this.BorderSize = value;

View file

@ -558,7 +558,7 @@ define([
}, },
applyBorderSize: function(value) { applyBorderSize: function(value) {
value = parseFloat(value); value = Common.Utils.String.parseFloat(value);
value = isNaN(value) ? 0 : Math.max(0, Math.min(1584, value)); value = isNaN(value) ? 0 : Math.max(0, Math.min(1584, value));
this.BorderSize = value; this.BorderSize = value;

View file

@ -1405,7 +1405,7 @@ define([
}); });
if (!item) { if (!item) {
value = /^\+?(\d*\.?\d+)$|^\+?(\d+\.?\d*)$/.exec(record.value); value = /^\+?(\d*(\.|,)?\d+)$|^\+?(\d+(\.|,)?\d*)$/.exec(record.value);
if (!value) { if (!value) {
value = this._getApiTextSize(); value = this._getApiTextSize();
@ -1426,7 +1426,7 @@ define([
} }
} }
} else { } else {
value = parseFloat(record.value); value = Common.Utils.String.parseFloat(record.value);
value = value > 409 ? 409 : value = value > 409 ? 409 :
value < 1 ? 1 : Math.floor((value+0.4)*2)/2; value < 1 ? 1 : Math.floor((value+0.4)*2)/2;

View file

@ -1138,7 +1138,7 @@ define([
}, },
applyBorderSize: function(value) { applyBorderSize: function(value) {
value = parseFloat(value); value = Common.Utils.String.parseFloat(value);
value = isNaN(value) ? 1 : Math.max(0.01, Math.min(1584, value)); value = isNaN(value) ? 1 : Math.max(0.01, Math.min(1584, value));
this.BorderSize = value; this.BorderSize = value;

View file

@ -851,7 +851,7 @@ define([
}); });
if (!item) { if (!item) {
value = /^\+?(\d*\.?\d+)$|^\+?(\d+\.?\d*)$/.exec(record.value); value = /^\+?(\d*(\.|,)?\d+)$|^\+?(\d+(\.|,)?\d*)$/.exec(record.value);
if (!value) { if (!value) {
value = combo.getValue(); value = combo.getValue();
@ -861,7 +861,7 @@ define([
} }
} }
} else { } else {
value = parseFloat(record.value); value = Common.Utils.String.parseFloat(record.value);
value = value > 409 ? 409 : value = value > 409 ? 409 :
value < 1 ? 1 : Math.floor((value+0.4)*2)/2; value < 1 ? 1 : Math.floor((value+0.4)*2)/2;

View file

@ -563,7 +563,7 @@ define([
}, },
applyBorderSize: function(value) { applyBorderSize: function(value) {
value = parseFloat(value); value = Common.Utils.String.parseFloat(value);
value = isNaN(value) ? 0 : Math.max(0, Math.min(1584, value)); value = isNaN(value) ? 0 : Math.max(0, Math.min(1584, value));
this.BorderSize = value; this.BorderSize = value;

View file

@ -559,7 +559,7 @@ define([
}, },
applyBorderSize: function(value) { applyBorderSize: function(value) {
value = parseFloat(value); value = Common.Utils.String.parseFloat(value);
value = isNaN(value) ? 0 : Math.max(0, Math.min(1584, value)); value = isNaN(value) ? 0 : Math.max(0, Math.min(1584, value));
this.BorderSize = value; this.BorderSize = value;