Gradient picker - Properly react to gradient changes once again

This commit is contained in:
Robert committed 2021-04-06 20:56:12 +02:00
1 parent b342eabe4d
commit 2bc882c814
4 files changed
+40 -19

No files matched your search

@@ -132,16 +132,12 @@ namespace Artemis.UI.Screens.ProfileEditor.Conditions.Abstract
DisposeRightSideDynamicViewModel();
if (RightSideInputViewModel == null)
CreateRightSideInputViewModel();
Type preferredType = DataModelConditionPredicate.GetPreferredRightSideType();
// Ensure the right static value is never null when the preferred type is a value type
if (preferredType.IsValueType && DataModelConditionPredicate.RightStaticValue == null)
RightSideInputViewModel.Value = preferredType.GetDefault();
else
RightSideInputViewModel.Value = DataModelConditionPredicate.RightStaticValue;
if (RightSideInputViewModel.TargetType != preferredType)
if (preferredType != null && RightSideInputViewModel.TargetType != preferredType)
RightSideInputViewModel.UpdateTargetType(preferredType);
RightSideInputViewModel.Value = DataModelConditionPredicate.RightStaticValue;
}
}
@@ -294,6 +290,12 @@ namespace Artemis.UI.Screens.ProfileEditor.Conditions.Abstract
private void RightSideSelectionViewModelOnSwitchToStaticRequested(object sender, EventArgs e)
{
DataModelConditionPredicate.PredicateType = ProfileRightSideType.Static;
// Ensure the right static value is never null when the preferred type is a value type
Type preferredType = DataModelConditionPredicate.GetPreferredRightSideType();
if (DataModelConditionPredicate.RightStaticValue == null && preferredType != null && preferredType.IsValueType)
DataModelConditionPredicate.UpdateRightSideStatic(preferredType.GetDefault());
Update();
}