From 93a3054af0582d0d6230f9d578161464ee64ba02 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 19 Dec 2017 10:38:36 +0100 Subject: [PATCH] Round layer heights to 2 decimals More difficult than I expected actually... Contributes to issue CURA-4655. --- resources/qml/SidebarSimple.qml | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/resources/qml/SidebarSimple.qml b/resources/qml/SidebarSimple.qml index 62cf6f9d34..76d8bb32df 100644 --- a/resources/qml/SidebarSimple.qml +++ b/resources/qml/SidebarSimple.qml @@ -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 }