Do not transform negative printhead min max values to positive while

displaying

CURA-6690
This commit is contained in:
Nino van Hooff 2019-09-19 13:56:37 +02:00
parent 5a95788493
commit 17a832f52f
3 changed files with 13 additions and 10 deletions

View file

@ -245,7 +245,7 @@ Item
axisName: "x" axisName: "x"
axisMinOrMax: "max" axisMinOrMax: "max"
allowNegativeValue: true allowNegativeValue: false
forceUpdateOnChangeFunction: forceUpdateFunction forceUpdateOnChangeFunction: forceUpdateFunction
} }
@ -266,7 +266,7 @@ Item
axisName: "y" axisName: "y"
axisMinOrMax: "max" axisMinOrMax: "max"
allowNegativeValue: true allowNegativeValue: false
forceUpdateOnChangeFunction: forceUpdateFunction forceUpdateOnChangeFunction: forceUpdateFunction
} }

View file

@ -35,6 +35,7 @@ UM.TooltipArea
property alias labelWidth: fieldLabel.width property alias labelWidth: fieldLabel.width
property alias unitText: unitLabel.text property alias unitText: unitLabel.text
property alias textField: textFieldWithUnit
property alias valueText: textFieldWithUnit.text property alias valueText: textFieldWithUnit.text
property alias valueValidator: textFieldWithUnit.validator property alias valueValidator: textFieldWithUnit.validator
property alias editingFinishedFunction: textFieldWithUnit.editingFinishedFunction property alias editingFinishedFunction: textFieldWithUnit.editingFinishedFunction

View file

@ -43,11 +43,14 @@ NumericTextFieldWithUnit
{ {
result = func(result, polygon[i][item]) result = func(result, polygon[i][item])
} }
result = Math.abs(result)
return 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 valueText: axisValue
editingFinishedFunction: function() editingFinishedFunction: function()
@ -55,19 +58,18 @@ NumericTextFieldWithUnit
var polygon = JSON.parse(propertyProvider.properties.value) var polygon = JSON.parse(propertyProvider.properties.value)
var newValue = parseFloat(valueText.replace(',', '.')) var newValue = parseFloat(valueText.replace(',', '.'))
if (axisName == "x") // x min/x max if (axisName == "x") // x min/x max
{ {
var start_i1 = (axisMinOrMax == "min") ? 0 : 2 var start_i1 = (axisMinOrMax == "min") ? 0 : 2
var factor = (axisMinOrMax == "min") ? -1 : 1 polygon[start_i1][0] = newValue
polygon[start_i1][0] = newValue * factor polygon[start_i1 + 1][0] = newValue
polygon[start_i1 + 1][0] = newValue * factor
} }
else // y min/y max else // y min/y max
{ {
var start_i1 = (axisMinOrMax == "min") ? 1 : 0 var start_i1 = (axisMinOrMax == "min") ? 1 : 0
var factor = (axisMinOrMax == "min") ? -1 : 1 polygon[start_i1][1] = newValue
polygon[start_i1][1] = newValue * factor polygon[start_i1 + 2][1] = newValue
polygon[start_i1 + 2][1] = newValue * factor
} }
var polygon_string = JSON.stringify(polygon) var polygon_string = JSON.stringify(polygon)
if (polygon_string != propertyProvider.properties.value) if (polygon_string != propertyProvider.properties.value)