mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-11-02 20:52:20 -07:00
Fix QML errors due to property providers not being initialised yet
This then updates in a fraction of a millisecond later before things even appear on the screen, so it's not so bad to not have a tooltip or to have it show 0 then. Done during Turbo Testing and Tooling.
This commit is contained in:
parent
31aee866f4
commit
2f3462203c
5 changed files with 17 additions and 14 deletions
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2019 Ultimaker B.V.
|
||||
// Copyright (c) 2020 Ultimaker B.V.
|
||||
// Cura is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
import QtQuick 2.10
|
||||
|
|
@ -35,15 +35,18 @@ NumericTextFieldWithUnit
|
|||
property string axisMinOrMax: "min"
|
||||
property var axisValue:
|
||||
{
|
||||
var polygon = JSON.parse(propertyProvider.properties.value)
|
||||
var item = (axisName == "x") ? 0 : 1
|
||||
var result = polygon[0][item]
|
||||
var func = (axisMinOrMax == "min") ? Math.min : Math.max
|
||||
if(propertyProvider.properties.value === undefined) { //PropertyProvider not initialised yet or there is no global stack.
|
||||
return 0;
|
||||
}
|
||||
var polygon = JSON.parse(propertyProvider.properties.value);
|
||||
var item = (axisName == "x") ? 0 : 1;
|
||||
var result = polygon[0][item];
|
||||
var func = (axisMinOrMax == "min") ? Math.min : Math.max;
|
||||
for (var i = 1; i < polygon.length; i++)
|
||||
{
|
||||
result = func(result, polygon[i][item])
|
||||
result = func(result, polygon[i][item]);
|
||||
}
|
||||
return result
|
||||
return result;
|
||||
}
|
||||
|
||||
valueText: axisValue
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue