diff options
author | Nino van Hooff <ninovanhooff@gmail.com> | 2019-09-19 14:56:37 +0300 |
---|---|---|
committer | Nino van Hooff <ninovanhooff@gmail.com> | 2019-09-19 14:56:37 +0300 |
commit | 17a832f52f14f2b7fae89e9a811cddb48725759a (patch) | |
tree | 803e34573e9880cdcafed2259e6d36dc62f7d758 | |
parent | 5a95788493622e205dc0b8244856e9630e7dc95c (diff) |
Do not transform negative printhead min max values to positive while
displaying
CURA-6690
3 files changed, 13 insertions, 10 deletions
diff --git a/plugins/MachineSettingsAction/MachineSettingsPrinterTab.qml b/plugins/MachineSettingsAction/MachineSettingsPrinterTab.qml index d817450f41..63c32d36cc 100644 --- a/plugins/MachineSettingsAction/MachineSettingsPrinterTab.qml +++ b/plugins/MachineSettingsAction/MachineSettingsPrinterTab.qml @@ -245,7 +245,7 @@ Item axisName: "x" axisMinOrMax: "max" - allowNegativeValue: true + allowNegativeValue: false forceUpdateOnChangeFunction: forceUpdateFunction } @@ -266,7 +266,7 @@ Item axisName: "y" axisMinOrMax: "max" - allowNegativeValue: true + allowNegativeValue: false forceUpdateOnChangeFunction: forceUpdateFunction } diff --git a/resources/qml/MachineSettings/NumericTextFieldWithUnit.qml b/resources/qml/MachineSettings/NumericTextFieldWithUnit.qml index 5921a39933..049282a6a0 100644 --- a/resources/qml/MachineSettings/NumericTextFieldWithUnit.qml +++ b/resources/qml/MachineSettings/NumericTextFieldWithUnit.qml @@ -35,6 +35,7 @@ UM.TooltipArea property alias labelWidth: fieldLabel.width property alias unitText: unitLabel.text + property alias textField: textFieldWithUnit property alias valueText: textFieldWithUnit.text property alias valueValidator: textFieldWithUnit.validator property alias editingFinishedFunction: textFieldWithUnit.editingFinishedFunction diff --git a/resources/qml/MachineSettings/PrintHeadMinMaxTextField.qml b/resources/qml/MachineSettings/PrintHeadMinMaxTextField.qml index 2eaaed4524..b78c1ae0db 100644 --- a/resources/qml/MachineSettings/PrintHeadMinMaxTextField.qml +++ b/resources/qml/MachineSettings/PrintHeadMinMaxTextField.qml @@ -43,11 +43,14 @@ NumericTextFieldWithUnit { result = func(result, polygon[i][item]) } - result = Math.abs(result) return result } - valueValidator: RegExpValidator { regExp: /[0-9\.,]{0,6}/ } + valueValidator: DoubleValidator { + bottom: allowNegativeValue ? Number.NEGATIVE_INFINITY : 0 + decimals: 6 + notation: DoubleValidator.StandardNotation + } valueText: axisValue editingFinishedFunction: function() @@ -55,19 +58,18 @@ NumericTextFieldWithUnit var polygon = JSON.parse(propertyProvider.properties.value) var newValue = parseFloat(valueText.replace(',', '.')) + if (axisName == "x") // x min/x max { var start_i1 = (axisMinOrMax == "min") ? 0 : 2 - var factor = (axisMinOrMax == "min") ? -1 : 1 - polygon[start_i1][0] = newValue * factor - polygon[start_i1 + 1][0] = newValue * factor + polygon[start_i1][0] = newValue + polygon[start_i1 + 1][0] = newValue } else // y min/y max { var start_i1 = (axisMinOrMax == "min") ? 1 : 0 - var factor = (axisMinOrMax == "min") ? -1 : 1 - polygon[start_i1][1] = newValue * factor - polygon[start_i1 + 2][1] = newValue * factor + polygon[start_i1][1] = newValue + polygon[start_i1 + 2][1] = newValue } var polygon_string = JSON.stringify(polygon) if (polygon_string != propertyProvider.properties.value) |