Fix Expressions not showing corectly
This commit is contained in:
parent
b12fcfaea0
commit
d0b02bc371
2 changed files with 17 additions and 13 deletions
|
|
@ -857,17 +857,6 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
};
|
||||
field.Initialize(0);
|
||||
field.SetValue(doubleExpresion.Expression, false);
|
||||
void EnsureFormating(double value)
|
||||
{
|
||||
var format = "0." + new string('#', 5);
|
||||
if (property.PropertyInfo.GetCustomAttributes(true).OfType<MaxDecimalPlacesAttribute>().FirstOrDefault() is MaxDecimalPlacesAttribute decimalPlaces)
|
||||
{
|
||||
format = "0." + new string('#', Math.Min(10, decimalPlaces.Number));
|
||||
}
|
||||
|
||||
field.TextValue = value.ToString(format);
|
||||
}
|
||||
EnsureFormating(doubleExpresion.Value(object3D));
|
||||
field.ClearUndoHistory();
|
||||
RegisterValueChanged(field,
|
||||
(valueString) => new DoubleOrExpression(valueString),
|
||||
|
|
@ -880,12 +869,27 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
|
||||
void RefreshField(object s, InvalidateArgs e)
|
||||
{
|
||||
// This code only executes when the in scene controls are updating the objects data and the display needs to tack them.
|
||||
if (e.InvalidateType.HasFlag(InvalidateType.DisplayValues))
|
||||
{
|
||||
DoubleOrExpression newValue = (DoubleOrExpression)property.Value;
|
||||
if (newValue.Expression != field.Value)
|
||||
{
|
||||
EnsureFormating(newValue.Value(object3D));
|
||||
// we should never be in the situation where there is an '=' as the in scene controls should be disabled
|
||||
if (newValue.Expression.StartsWith("="))
|
||||
{
|
||||
field.TextValue = newValue.Expression;
|
||||
}
|
||||
else
|
||||
{
|
||||
var format = "0." + new string('#', 5);
|
||||
if (property.PropertyInfo.GetCustomAttributes(true).OfType<MaxDecimalPlacesAttribute>().FirstOrDefault() is MaxDecimalPlacesAttribute decimalPlaces)
|
||||
{
|
||||
format = "0." + new string('#', Math.Min(10, decimalPlaces.Number));
|
||||
}
|
||||
|
||||
field.TextValue = newValue.Value(object3D).ToString(format);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit c4d395b08e2185e20f72990354aa133fc73eacdf
|
||||
Subproject commit 7cf400f33c8a740b09bd78575abef7679f8bb060
|
||||
Loading…
Add table
Add a link
Reference in a new issue