Allow decimal point for values input in materials view

CURA-8684
This commit is contained in:
casper 2022-01-30 23:19:11 +01:00
parent 29fc98fea4
commit f62a5e7340

View File

@ -270,7 +270,7 @@ OldControls.TabView
valueFromText: function(text) { valueFromText: function(text) {
// remove all non-number tokens from input string so value can be parsed correctly // remove all non-number tokens from input string so value can be parsed correctly
var value = Number(text.replace(/[^0-9.-]+/g, "")); var value = Number(text.replace(",", ".").replace(/[^0-9.-]+/g, ""));
var precision = Math.pow(10, spoolCostSpinBox.decimals); var precision = Math.pow(10, spoolCostSpinBox.decimals);
return Math.round(value * precision) / precision; return Math.round(value * precision) / precision;
} }
@ -298,7 +298,7 @@ OldControls.TabView
valueFromText: function(text, locale) { valueFromText: function(text, locale) {
// remove all non-number tokens from input string so value can be parsed correctly // remove all non-number tokens from input string so value can be parsed correctly
var value = Number(text.replace(/[^0-9.-]+/g, "")); var value = Number(text.replace(",", ".").replace(/[^0-9.-]+/g, ""));
return Math.round(value); return Math.round(value);
} }