Round layer heights to 2 decimals

More difficult than I expected actually...

Contributes to issue CURA-4655.
This commit is contained in:
Ghostkeeper 2017-12-19 10:38:36 +01:00 committed by Tyler Gibson
parent 80f50dfff5
commit 93a3054af0

View file

@ -183,12 +183,22 @@ Item
text:
{
var result = ""
if(Cura.MachineManager.activeMachine != null){
var result = Cura.ProfilesModel.getItem(index).layer_height_without_unit
if(Cura.MachineManager.activeMachine != null)
{
result = Cura.ProfilesModel.getItem(index).layer_height_without_unit
if(result == undefined)
result = ""
{
result = "";
}
else
{
result = Number(Math.round(result + "e+2") + "e-2"); //Round to 2 decimals. Javascript makes this difficult...
if (result == undefined || result != result) //Parse failure.
{
result = "";
}
}
}
return result
}