Core - Create default instances for properties

UI - Added configurable width/height for brush dialogs
This commit is contained in:
Robert committed 2021-04-08 00:39:26 +02:00
1 parent f4e3011957
commit 903e434137
12 files changed
+109 -14

No files matched your search

@@ -9,6 +9,7 @@
RegisterDataBindingProperty(() => CurrentValue.End, value => CurrentValue.End = value, new FloatDataBindingConverter<FloatRange>(), "End");
CurrentValueSet += OnCurrentValueSet;
DefaultValue = new FloatRange();
}
/// <inheritdoc />
@@ -25,7 +26,7 @@
private void OnCurrentValueSet(object? sender, LayerPropertyEventArgs e)
{
// Don't allow the int range to be null
BaseValue ??= DefaultValue ?? new FloatRange(0, 0);
BaseValue ??= DefaultValue ?? new FloatRange();
}
}
}
@@ -9,6 +9,7 @@
RegisterDataBindingProperty(() => CurrentValue.End, value => CurrentValue.End = value, new IntDataBindingConverter<IntRange>(), "End");
CurrentValueSet += OnCurrentValueSet;
DefaultValue = new IntRange();
}
/// <inheritdoc />
@@ -25,7 +26,7 @@
private void OnCurrentValueSet(object? sender, LayerPropertyEventArgs e)
{
// Don't allow the int range to be null
BaseValue ??= DefaultValue ?? new IntRange(0, 0);
BaseValue ??= DefaultValue ?? new IntRange();
}
}
}
@@ -9,6 +9,14 @@ namespace Artemis.Core
{
private readonly Random _rand;
/// <summary>
/// Creates a new instance of the <see cref="FloatRange" /> class
/// </summary>
public FloatRange()
{
_rand = new Random();
}
/// <summary>
/// Creates a new instance of the <see cref="FloatRange" /> class
/// </summary>
@@ -9,6 +9,14 @@ namespace Artemis.Core
{
private readonly Random _rand;
/// <summary>
/// Creates a new instance of the <see cref="IntRange" /> class
/// </summary>
public IntRange()
{
_rand = new Random();
}
/// <summary>
/// Creates a new instance of the <see cref="IntRange" /> class
/// </summary>
@@ -34,7 +34,7 @@ namespace Artemis.Core
CurrentValue = default!;
DefaultValue = default!;
_baseValue = default!;
_baseValue = typeof(T).IsValueType ? default! : Activator.CreateInstance<T>();
_keyframes = new List<LayerPropertyKeyframe<T>>();
}