diff --git a/src/Artemis.Core/DefaultTypes/Properties/ColorGradientLayerProperty.cs b/src/Artemis.Core/DefaultTypes/Properties/ColorGradientLayerProperty.cs
index cc996aa4a..92e9a22f8 100644
--- a/src/Artemis.Core/DefaultTypes/Properties/ColorGradientLayerProperty.cs
+++ b/src/Artemis.Core/DefaultTypes/Properties/ColorGradientLayerProperty.cs
@@ -8,7 +8,7 @@
KeyframesSupported = false;
DataBindingsSupported = false;
- BaseValueChanged += OnBaseValueChanged;
+ CurrentValueSet += OnCurrentValueSet;
}
///
@@ -25,7 +25,7 @@
throw new ArtemisCoreException("Color Gradients do not support keyframes.");
}
- private void OnBaseValueChanged(object sender, LayerPropertyEventArgs e)
+ private void OnCurrentValueSet(object sender, LayerPropertyEventArgs e)
{
// Don't allow color gradients to be null
if (BaseValue == null)
diff --git a/src/Artemis.Core/Models/Profile/Layer.cs b/src/Artemis.Core/Models/Profile/Layer.cs
index 8dbdb4311..f1fa2cc3a 100644
--- a/src/Artemis.Core/Models/Profile/Layer.cs
+++ b/src/Artemis.Core/Models/Profile/Layer.cs
@@ -157,7 +157,7 @@ namespace Artemis.Core
Transform.GroupDescription = (PropertyGroupDescriptionAttribute) transformAttribute;
Transform.Initialize(this, "Transform.", Constants.CorePluginInfo);
- General.ShapeType.BaseValueChanged += ShapeTypeOnBaseValueChanged;
+ General.ShapeType.CurrentValueSet += ShapeTypeOnCurrentValueSet;
ApplyShapeType();
ActivateLayerBrush();
}
@@ -213,7 +213,7 @@ namespace Artemis.Core
#region Shape management
- private void ShapeTypeOnBaseValueChanged(object sender, EventArgs e)
+ private void ShapeTypeOnCurrentValueSet(object sender, EventArgs e)
{
ApplyShapeType();
}
diff --git a/src/Artemis.Core/Models/Profile/LayerProperties/LayerProperty.cs b/src/Artemis.Core/Models/Profile/LayerProperties/LayerProperty.cs
index f9dcfdc58..f6a7c03f1 100644
--- a/src/Artemis.Core/Models/Profile/LayerProperties/LayerProperty.cs
+++ b/src/Artemis.Core/Models/Profile/LayerProperties/LayerProperty.cs
@@ -15,7 +15,7 @@ namespace Artemis.Core
///
///
/// The type of property encapsulated in this layer property
- public abstract class LayerProperty : ILayerProperty
+ public class LayerProperty : ILayerProperty
{
private bool _disposed;
@@ -120,8 +120,7 @@ namespace Artemis.Core
_baseValue = value;
Update(0);
- OnBaseValueChanged();
- LayerPropertyGroup.OnLayerPropertyBaseValueChanged(new LayerPropertyEventArgs(this));
+ OnCurrentValueSet();
}
}
@@ -165,6 +164,7 @@ namespace Artemis.Core
// Force an update so that the base value is applied to the current value and
// keyframes/data bindings are applied using the new base value
Update(0);
+ OnCurrentValueSet();
}
///
@@ -534,9 +534,9 @@ namespace Artemis.Core
public event EventHandler> Updated;
///
- /// Occurs when the base value of the layer property was updated
+ /// Occurs when the current value of the layer property was updated by some form of input
///
- public event EventHandler> BaseValueChanged;
+ public event EventHandler> CurrentValueSet;
///
/// Occurs when the value of the layer property was updated
@@ -573,9 +573,10 @@ namespace Artemis.Core
Updated?.Invoke(this, new LayerPropertyEventArgs(this));
}
- protected virtual void OnBaseValueChanged()
+ protected virtual void OnCurrentValueSet()
{
- BaseValueChanged?.Invoke(this, new LayerPropertyEventArgs(this));
+ CurrentValueSet?.Invoke(this, new LayerPropertyEventArgs(this));
+ LayerPropertyGroup.OnLayerPropertyOnCurrentValueSet(new LayerPropertyEventArgs(this));
}
protected virtual void OnVisibilityChanged()
diff --git a/src/Artemis.Core/Models/Profile/LayerPropertyGroup.cs b/src/Artemis.Core/Models/Profile/LayerPropertyGroup.cs
index a355747ce..b3cc9ac8e 100644
--- a/src/Artemis.Core/Models/Profile/LayerPropertyGroup.cs
+++ b/src/Artemis.Core/Models/Profile/LayerPropertyGroup.cs
@@ -274,10 +274,10 @@ namespace Artemis.Core
public event EventHandler PropertyGroupInitialized;
///
- /// Occurs when one of the base value of one of the layer properties in this group changes
+ /// Occurs when one of the current value of one of the layer properties in this group changes by some form of input
/// Note: Will not trigger on properties in child groups
///
- public event EventHandler LayerPropertyBaseValueChanged;
+ public event EventHandler LayerPropertyOnCurrentValueSet;
///
/// Occurs when the value of the layer property was updated
@@ -294,9 +294,9 @@ namespace Artemis.Core
VisibilityChanged?.Invoke(this, EventArgs.Empty);
}
- internal virtual void OnLayerPropertyBaseValueChanged(LayerPropertyEventArgs e)
+ internal virtual void OnLayerPropertyOnCurrentValueSet(LayerPropertyEventArgs e)
{
- LayerPropertyBaseValueChanged?.Invoke(this, e);
+ LayerPropertyOnCurrentValueSet?.Invoke(this, e);
}
#endregion
diff --git a/src/Artemis.UI.Shared/Controls/DraggableFloat.xaml b/src/Artemis.UI.Shared/Controls/DraggableFloat.xaml
index 7d59a307a..7e7cb1016 100644
--- a/src/Artemis.UI.Shared/Controls/DraggableFloat.xaml
+++ b/src/Artemis.UI.Shared/Controls/DraggableFloat.xaml
@@ -65,6 +65,7 @@
KeyDown="InputKeyDown"
Visibility="Collapsed"
RequestBringIntoView="Input_OnRequestBringIntoView"
- PreviewTextInput="Input_PreviewTextInput" />
+ PreviewTextInput="Input_PreviewTextInput"
+ DataObject.Pasting="Input_OnPasting"/>
\ No newline at end of file
diff --git a/src/Artemis.UI.Shared/Controls/DraggableFloat.xaml.cs b/src/Artemis.UI.Shared/Controls/DraggableFloat.xaml.cs
index b56f551ce..325a14c24 100644
--- a/src/Artemis.UI.Shared/Controls/DraggableFloat.xaml.cs
+++ b/src/Artemis.UI.Shared/Controls/DraggableFloat.xaml.cs
@@ -1,8 +1,6 @@
using System;
using System.ComponentModel;
-using System.Globalization;
using System.Runtime.CompilerServices;
-using System.Text.RegularExpressions;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
@@ -18,6 +16,8 @@ namespace Artemis.UI.Shared
new FrameworkPropertyMetadata(default(float), FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, FloatPropertyChangedCallback));
public static readonly DependencyProperty StepSizeProperty = DependencyProperty.Register(nameof(StepSize), typeof(float), typeof(DraggableFloat));
+ public static readonly DependencyProperty MinProperty = DependencyProperty.Register(nameof(Min), typeof(float?), typeof(DraggableFloat));
+ public static readonly DependencyProperty MaxProperty = DependencyProperty.Register(nameof(Max), typeof(float?), typeof(DraggableFloat));
public static readonly RoutedEvent ValueChangedEvent =
EventManager.RegisterRoutedEvent(
@@ -49,6 +49,18 @@ namespace Artemis.UI.Shared
set => SetValue(StepSizeProperty, value);
}
+ public float? Min
+ {
+ get => (float?) GetValue(MinProperty);
+ set => SetValue(MinProperty, value);
+ }
+
+ public float? Max
+ {
+ get => (float?) GetValue(MaxProperty);
+ set => SetValue(MaxProperty, value);
+ }
+
public event PropertyChangedEventHandler PropertyChanged;
public event EventHandler DragStarted;
@@ -126,7 +138,16 @@ namespace Artemis.UI.Shared
if (stepSize == 0)
stepSize = 0.1m;
- Value = (float) UltimateRoundingFunction(startValue + stepSize * (x - startX), stepSize, 0.5m);
+ if (Keyboard.IsKeyDown(Key.LeftShift) || Keyboard.IsKeyDown(Key.RightShift))
+ stepSize = stepSize * 10;
+
+ var value = (float) UltimateRoundingFunction(startValue + stepSize * (x - startX), stepSize, 0.5m);
+ if (Min != null)
+ value = Math.Max(value, Min.Value);
+ if (Max != null)
+ value = Math.Min(value, Max.Value);
+
+ Value = value;
}
private void InputLostFocus(object sender, RoutedEventArgs e)
@@ -166,9 +187,34 @@ namespace Artemis.UI.Shared
private void Input_PreviewTextInput(object sender, TextCompositionEventArgs e)
{
- var seperator = CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator;
- var regex = new Regex("^[" + seperator + "][-|0-9]+$|^-?[0-9]*[" + seperator + "]{0,1}[0-9]*$");
- e.Handled = !regex.IsMatch(e.Text);
+ e.Handled = !ValidateInput(sender, e);
+ }
+
+ private void Input_OnPasting(object sender, DataObjectPastingEventArgs e)
+ {
+ if (e.DataObject.GetDataPresent(typeof(string)))
+ {
+ var text = (string) e.DataObject.GetData(typeof(string));
+ if (!float.TryParse(text, out _))
+ e.CancelCommand();
+ }
+ else
+ e.CancelCommand();
+ }
+
+ // Borrowed from https://stackoverflow.com/a/48082972/5015269 because a regex approach has bad compatibility with
+ // different locales
+ private bool ValidateInput(object sender, TextCompositionEventArgs e)
+ {
+ if (!(sender is TextBox textBox))
+ return false;
+
+ // Use SelectionStart property to find the caret position.
+ // Insert the previewed text into the existing text in the textbox.
+ var fullText = textBox.Text.Insert(textBox.SelectionStart, e.Text);
+
+ // If parsing is successful, set Handled to false
+ return float.TryParse(fullText, out _);
}
private static decimal UltimateRoundingFunction(decimal amountToRound, decimal nearstOf, decimal fairness)
diff --git a/src/Artemis.UI.Shared/PropertyInput/PropertyInputViewModel.cs b/src/Artemis.UI.Shared/PropertyInput/PropertyInputViewModel.cs
index bea49d60f..d678ce9f9 100644
--- a/src/Artemis.UI.Shared/PropertyInput/PropertyInputViewModel.cs
+++ b/src/Artemis.UI.Shared/PropertyInput/PropertyInputViewModel.cs
@@ -15,7 +15,7 @@ namespace Artemis.UI.Shared
LayerProperty = layerProperty;
ProfileEditorService = profileEditorService;
LayerProperty.Updated += LayerPropertyOnUpdated;
- LayerProperty.BaseValueChanged += LayerPropertyOnUpdated;
+ LayerProperty.CurrentValueSet += LayerPropertyOnUpdated;
LayerProperty.DataBindingEnabled += LayerPropertyOnDataBindingChange;
LayerProperty.DataBindingDisabled += LayerPropertyOnDataBindingChange;
UpdateInputValue();
@@ -26,7 +26,7 @@ namespace Artemis.UI.Shared
LayerProperty = layerProperty;
ProfileEditorService = profileEditorService;
LayerProperty.Updated += LayerPropertyOnUpdated;
- LayerProperty.BaseValueChanged += LayerPropertyOnUpdated;
+ LayerProperty.CurrentValueSet += LayerPropertyOnUpdated;
LayerProperty.DataBindingEnabled += LayerPropertyOnDataBindingChange;
LayerProperty.DataBindingDisabled += LayerPropertyOnDataBindingChange;
UpdateInputValue();
@@ -56,7 +56,7 @@ namespace Artemis.UI.Shared
public override void Dispose()
{
LayerProperty.Updated -= LayerPropertyOnUpdated;
- LayerProperty.BaseValueChanged -= LayerPropertyOnUpdated;
+ LayerProperty.CurrentValueSet -= LayerPropertyOnUpdated;
LayerProperty.DataBindingEnabled -= LayerPropertyOnDataBindingChange;
LayerProperty.DataBindingDisabled -= LayerPropertyOnDataBindingChange;
Dispose(true);
diff --git a/src/Artemis.UI.Shared/Screens/Dialogs/ConfirmDialogView.xaml b/src/Artemis.UI.Shared/Screens/Dialogs/ConfirmDialogView.xaml
index be6887eff..c8afa5fa8 100644
--- a/src/Artemis.UI.Shared/Screens/Dialogs/ConfirmDialogView.xaml
+++ b/src/Artemis.UI.Shared/Screens/Dialogs/ConfirmDialogView.xaml
@@ -13,11 +13,19 @@
-
-
-
+
+
+
+
\ No newline at end of file
diff --git a/src/Artemis.UI.Shared/Services/Interfaces/IDialogService.cs b/src/Artemis.UI.Shared/Services/Interfaces/IDialogService.cs
index c428d49c4..2687833c7 100644
--- a/src/Artemis.UI.Shared/Services/Interfaces/IDialogService.cs
+++ b/src/Artemis.UI.Shared/Services/Interfaces/IDialogService.cs
@@ -12,7 +12,7 @@ namespace Artemis.UI.Shared.Services
public interface IDialogService : IArtemisSharedUIService
{
///
- /// Shows a confirm dialog on the dialog host provided
+ /// Shows a confirm dialog on the main dialog host
///
/// The title of the dialog
/// The body text of the dialog
diff --git a/src/Artemis.UI/DefaultTypes/PropertyInput/FloatPropertyInputView.xaml b/src/Artemis.UI/DefaultTypes/PropertyInput/FloatPropertyInputView.xaml
index 44ce18165..380b086f7 100644
--- a/src/Artemis.UI/DefaultTypes/PropertyInput/FloatPropertyInputView.xaml
+++ b/src/Artemis.UI/DefaultTypes/PropertyInput/FloatPropertyInputView.xaml
@@ -15,6 +15,8 @@
diff --git a/src/Artemis.UI/DefaultTypes/PropertyInput/IntPropertyInputView.xaml b/src/Artemis.UI/DefaultTypes/PropertyInput/IntPropertyInputView.xaml
index 20dd7b5ab..caa83056c 100644
--- a/src/Artemis.UI/DefaultTypes/PropertyInput/IntPropertyInputView.xaml
+++ b/src/Artemis.UI/DefaultTypes/PropertyInput/IntPropertyInputView.xaml
@@ -15,6 +15,8 @@
diff --git a/src/Artemis.UI/DefaultTypes/PropertyInput/SKPointPropertyInputView.xaml b/src/Artemis.UI/DefaultTypes/PropertyInput/SKPointPropertyInputView.xaml
index 7fc7753d8..5044a5c10 100644
--- a/src/Artemis.UI/DefaultTypes/PropertyInput/SKPointPropertyInputView.xaml
+++ b/src/Artemis.UI/DefaultTypes/PropertyInput/SKPointPropertyInputView.xaml
@@ -14,6 +14,8 @@
@@ -21,6 +23,8 @@
diff --git a/src/Artemis.UI/DefaultTypes/PropertyInput/SKSizePropertyInputView.xaml b/src/Artemis.UI/DefaultTypes/PropertyInput/SKSizePropertyInputView.xaml
index 03a2e1440..d2e9193e0 100644
--- a/src/Artemis.UI/DefaultTypes/PropertyInput/SKSizePropertyInputView.xaml
+++ b/src/Artemis.UI/DefaultTypes/PropertyInput/SKSizePropertyInputView.xaml
@@ -14,6 +14,8 @@
@@ -21,6 +23,8 @@
diff --git a/src/Artemis.UI/Screens/ProfileEditor/DisplayConditions/DisplayConditionGroupViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/DisplayConditions/DisplayConditionGroupViewModel.cs
index 61fbad0ec..f337d80dc 100644
--- a/src/Artemis.UI/Screens/ProfileEditor/DisplayConditions/DisplayConditionGroupViewModel.cs
+++ b/src/Artemis.UI/Screens/ProfileEditor/DisplayConditions/DisplayConditionGroupViewModel.cs
@@ -103,7 +103,7 @@ namespace Artemis.UI.Screens.ProfileEditor.DisplayConditions
var toRemove = Items.Where(c => !DisplayConditionGroup.Children.Contains(c.Model)).ToList();
// Using RemoveRange breaks our lovely animations
foreach (var displayConditionViewModel in toRemove)
- CloseItem(displayConditionViewModel);
+ Items.Remove(displayConditionViewModel);
foreach (var childModel in Model.Children)
{
@@ -113,18 +113,18 @@ namespace Artemis.UI.Screens.ProfileEditor.DisplayConditions
switch (childModel)
{
case DisplayConditionGroup displayConditionGroup:
- ActivateItem(_displayConditionsVmFactory.DisplayConditionGroupViewModel(displayConditionGroup, IsListGroup));
+ Items.Add(_displayConditionsVmFactory.DisplayConditionGroupViewModel(displayConditionGroup, IsListGroup));
break;
case DisplayConditionList displayConditionListPredicate:
- ActivateItem(_displayConditionsVmFactory.DisplayConditionListViewModel(displayConditionListPredicate));
+ Items.Add(_displayConditionsVmFactory.DisplayConditionListViewModel(displayConditionListPredicate));
break;
case DisplayConditionPredicate displayConditionPredicate:
if (!IsListGroup)
- ActivateItem(_displayConditionsVmFactory.DisplayConditionPredicateViewModel(displayConditionPredicate));
+ Items.Add(_displayConditionsVmFactory.DisplayConditionPredicateViewModel(displayConditionPredicate));
break;
case DisplayConditionListPredicate displayConditionListPredicate:
if (IsListGroup)
- ActivateItem(_displayConditionsVmFactory.DisplayConditionListPredicateViewModel(displayConditionListPredicate));
+ Items.Add(_displayConditionsVmFactory.DisplayConditionListPredicateViewModel(displayConditionListPredicate));
break;
}
}
diff --git a/src/Artemis.UI/Screens/ProfileEditor/DisplayConditions/DisplayConditionListViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/DisplayConditions/DisplayConditionListViewModel.cs
index f627d87bc..4cf4cb2a2 100644
--- a/src/Artemis.UI/Screens/ProfileEditor/DisplayConditions/DisplayConditionListViewModel.cs
+++ b/src/Artemis.UI/Screens/ProfileEditor/DisplayConditions/DisplayConditionListViewModel.cs
@@ -152,7 +152,7 @@ namespace Artemis.UI.Screens.ProfileEditor.DisplayConditions
var toRemove = Items.Where(c => !DisplayConditionList.Children.Contains(c.Model)).ToList();
// Using RemoveRange breaks our lovely animations
foreach (var displayConditionViewModel in toRemove)
- CloseItem(displayConditionViewModel);
+ Items.Remove(displayConditionViewModel);
foreach (var childModel in Model.Children)
{
@@ -163,7 +163,7 @@ namespace Artemis.UI.Screens.ProfileEditor.DisplayConditions
var viewModel = _displayConditionsVmFactory.DisplayConditionGroupViewModel(displayConditionGroup, true);
viewModel.IsRootGroup = true;
- ActivateItem(viewModel);
+ Items.Add(viewModel);
}
foreach (var childViewModel in Items)
diff --git a/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/DataBindings/DataBindingsViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/DataBindings/DataBindingsViewModel.cs
index b9b454236..4473cba7b 100644
--- a/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/DataBindings/DataBindingsViewModel.cs
+++ b/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/DataBindings/DataBindingsViewModel.cs
@@ -39,7 +39,7 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.DataBindings
// Create a data binding VM for each data bindable property. These VMs will be responsible for retrieving
// and creating the actual data bindings
foreach (var registration in registrations)
- ActivateItem(_dataBindingsVmFactory.DataBindingViewModel(registration));
+ Items.Add(_dataBindingsVmFactory.DataBindingViewModel(registration));
SelectedItemIndex = 0;
}
diff --git a/src/Artemis.UI/Screens/ProfileEditor/ProfileTree/ProfileTreeView.xaml b/src/Artemis.UI/Screens/ProfileEditor/ProfileTree/ProfileTreeView.xaml
index 32eb00d36..2bfeabae5 100644
--- a/src/Artemis.UI/Screens/ProfileEditor/ProfileTree/ProfileTreeView.xaml
+++ b/src/Artemis.UI/Screens/ProfileEditor/ProfileTree/ProfileTreeView.xaml
@@ -9,62 +9,67 @@
xmlns:behaviors="clr-namespace:Artemis.UI.Behaviors"
xmlns:b="http://schemas.microsoft.com/xaml/behaviors"
xmlns:profileTree1="clr-namespace:Artemis.UI.Screens.ProfileEditor.ProfileTree"
- xmlns:treeItem1="clr-namespace:Artemis.UI.Screens.ProfileEditor.ProfileTree.TreeItem"
+ xmlns:treeItem="clr-namespace:Artemis.UI.Screens.ProfileEditor.ProfileTree.TreeItem"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800"
d:DataContext="{d:DesignInstance {x:Type profileTree1:ProfileTreeViewModel}}">
-
-
-
-
-
-
-
-
- Profile elements
-
-
-
+
+
+
+
+
+
+
+
+
+ Profile elements
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Artemis.UI/Screens/ProfileEditor/ProfileTree/TreeItem/TreeItemViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/ProfileTree/TreeItem/TreeItemViewModel.cs
index 435ca6937..88ffce82e 100644
--- a/src/Artemis.UI/Screens/ProfileEditor/ProfileTree/TreeItem/TreeItemViewModel.cs
+++ b/src/Artemis.UI/Screens/ProfileEditor/ProfileTree/TreeItem/TreeItemViewModel.cs
@@ -71,6 +71,8 @@ namespace Artemis.UI.Screens.ProfileEditor.ProfileTree.TreeItem
{
var sourceParent = (TreeItemViewModel) source.Parent;
var parent = (TreeItemViewModel) Parent;
+
+ // If the parents are different, remove the element from the old parent and add it to the new parent
if (source.Parent != Parent)
{
sourceParent.RemoveExistingElement(source);
@@ -146,7 +148,8 @@ namespace Artemis.UI.Screens.ProfileEditor.ProfileTree.TreeItem
// ReSharper disable once UnusedMember.Global - Called from view
public async Task RenameElement()
{
- var result = await _dialogService.ShowDialog(
+ var result = await _dialogService.ShowDialogAt(
+ "ProfileTreeDialog",
new Dictionary
{
{"subject", ProfileElement is Folder ? "folder" : "layer"},
@@ -163,9 +166,10 @@ namespace Artemis.UI.Screens.ProfileEditor.ProfileTree.TreeItem
// ReSharper disable once UnusedMember.Global - Called from view
public async Task DeleteElement()
{
- var result = await _dialogService.ShowConfirmDialog(
+ var result = await _dialogService.ShowConfirmDialogAt(
+ "ProfileTreeDialog",
"Delete profile element",
- "Are you sure you want to delete this element? This cannot be undone."
+ "Are you sure?"
);
if (!result)
@@ -185,7 +189,7 @@ namespace Artemis.UI.Screens.ProfileEditor.ProfileTree.TreeItem
// Remove VMs that are no longer a child
var toRemove = Items.Where(c => c.ProfileElement.Parent != ProfileElement).ToList();
foreach (var treeItemViewModel in toRemove)
- DeactivateItem(treeItemViewModel);
+ Items.Remove(treeItemViewModel);
// Order the children
var vmsList = Items.OrderBy(v => v.ProfileElement.Order).ToList();
@@ -222,7 +226,7 @@ namespace Artemis.UI.Screens.ProfileEditor.ProfileTree.TreeItem
foreach (var treeItemViewModel in newChildren)
{
treeItemViewModel.UpdateProfileElements();
- ActivateItem(treeItemViewModel);
+ Items.Add(treeItemViewModel);
}
}
diff --git a/src/Artemis.UI/Screens/ProfileEditor/Visualization/ProfileViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/Visualization/ProfileViewModel.cs
index b1ec9cc9d..64d7060d9 100644
--- a/src/Artemis.UI/Screens/ProfileEditor/Visualization/ProfileViewModel.cs
+++ b/src/Artemis.UI/Screens/ProfileEditor/Visualization/ProfileViewModel.cs
@@ -31,7 +31,6 @@ namespace Artemis.UI.Screens.ProfileEditor.Visualization
private BindableCollection _devices;
private BindableCollection _highlightedLeds;
private PluginSetting _highlightSelectedLayer;
- private bool _isInitializing;
private PluginSetting _onlyShowSelectedShape;
private PanZoomViewModel _panZoomViewModel;
private Layer _previousSelectedLayer;
@@ -67,12 +66,6 @@ namespace Artemis.UI.Screens.ProfileEditor.Visualization
eventAggregator.Subscribe(this);
}
- public bool IsInitializing
- {
- get => _isInitializing;
- private set => SetAndNotify(ref _isInitializing, value);
- }
-
public bool CanSelectEditTool
{
get => _canSelectEditTool;
@@ -375,11 +368,16 @@ namespace Artemis.UI.Screens.ProfileEditor.Visualization
private void OnProfileElementSelected(object sender, EventArgs e)
{
if (_previousSelectedLayer != null)
+ {
_previousSelectedLayer.LayerBrushUpdated -= SelectedLayerOnLayerBrushUpdated;
+ _previousSelectedLayer.Transform.LayerPropertyOnCurrentValueSet -= TransformValueChanged;
+ }
+
if (_profileEditorService.SelectedProfileElement is Layer layer)
{
_previousSelectedLayer = layer;
_previousSelectedLayer.LayerBrushUpdated += SelectedLayerOnLayerBrushUpdated;
+ _previousSelectedLayer.Transform.LayerPropertyOnCurrentValueSet += TransformValueChanged;
}
else
_previousSelectedLayer = null;
@@ -392,7 +390,13 @@ namespace Artemis.UI.Screens.ProfileEditor.Visualization
{
UpdateCanSelectEditTool();
}
-
+
+ private void TransformValueChanged(object? sender, LayerPropertyEventArgs e)
+ {
+ if (ActiveToolIndex != 1)
+ ActivateToolByIndex(1);
+ }
+
private void OnSelectedProfileElementUpdated(object sender, EventArgs e)
{
ApplyActiveProfile();
diff --git a/src/Artemis.UI/Screens/ProfileEditor/Visualization/UserControls/LayerShapeControl.xaml b/src/Artemis.UI/Screens/ProfileEditor/Visualization/UserControls/LayerShapeControl.xaml
index 15286439e..c1c3ed093 100644
--- a/src/Artemis.UI/Screens/ProfileEditor/Visualization/UserControls/LayerShapeControl.xaml
+++ b/src/Artemis.UI/Screens/ProfileEditor/Visualization/UserControls/LayerShapeControl.xaml
@@ -36,7 +36,6 @@
Data="{Binding ShapeGeometry, Mode=OneWay}"
Fill="Transparent"
Stroke="{DynamicResource PrimaryHueMidBrush}"
- StrokeThickness="{Binding OutlineThickness}"
StrokeDashArray="2 2"
Cursor="/Resources/Cursors/aero_drag.cur"
MouseDown="MoveOnMouseDown"
diff --git a/src/Artemis.UI/Screens/RootView.xaml b/src/Artemis.UI/Screens/RootView.xaml
index 8dd3e3221..42594df85 100644
--- a/src/Artemis.UI/Screens/RootView.xaml
+++ b/src/Artemis.UI/Screens/RootView.xaml
@@ -49,31 +49,41 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
\ No newline at end of file
diff --git a/src/Plugins/Artemis.Plugins.LayerBrushes.Color/ColorBrush.cs b/src/Plugins/Artemis.Plugins.LayerBrushes.Color/ColorBrush.cs
index d158dc37b..9d66cbca8 100644
--- a/src/Plugins/Artemis.Plugins.LayerBrushes.Color/ColorBrush.cs
+++ b/src/Plugins/Artemis.Plugins.LayerBrushes.Color/ColorBrush.cs
@@ -19,17 +19,14 @@ namespace Artemis.Plugins.LayerBrushes.Color
public override void EnableLayerBrush()
{
Layer.RenderPropertiesUpdated += HandleShaderChange;
- Properties.LayerPropertyBaseValueChanged += HandleShaderChange;
+ Properties.LayerPropertyOnCurrentValueSet += HandleShaderChange;
Properties.Colors.BaseValue.PropertyChanged += BaseValueOnPropertyChanged;
}
public override void DisableLayerBrush()
{
Layer.RenderPropertiesUpdated -= HandleShaderChange;
- Properties.GradientType.BaseValueChanged -= HandleShaderChange;
- Properties.Color.BaseValueChanged -= HandleShaderChange;
- Properties.TileMode.BaseValueChanged -= HandleShaderChange;
- Properties.ColorsMultiplier.BaseValueChanged -= HandleShaderChange;
+ Properties.LayerPropertyOnCurrentValueSet -= HandleShaderChange;
Properties.Colors.BaseValue.PropertyChanged -= BaseValueOnPropertyChanged;
_paint?.Dispose();
diff --git a/src/Plugins/Artemis.Plugins.LayerBrushes.Color/PropertyGroups/ColorBrushProperties.cs b/src/Plugins/Artemis.Plugins.LayerBrushes.Color/PropertyGroups/ColorBrushProperties.cs
index 9fb39f515..353fa5e43 100644
--- a/src/Plugins/Artemis.Plugins.LayerBrushes.Color/PropertyGroups/ColorBrushProperties.cs
+++ b/src/Plugins/Artemis.Plugins.LayerBrushes.Color/PropertyGroups/ColorBrushProperties.cs
@@ -38,26 +38,26 @@ namespace Artemis.Plugins.LayerBrushes.Color.PropertyGroups
protected override void EnableProperties()
{
- GradientType.BaseValueChanged += GradientTypeOnBaseValueChanged;
+ GradientType.CurrentValueSet += GradientTypeOnCurrentValueSet;
if (ProfileElement is Layer layer)
- layer.General.ResizeMode.BaseValueChanged += ResizeModeOnBaseValueChanged;
+ layer.General.ResizeMode.CurrentValueSet += ResizeModeOnCurrentValueSet;
UpdateVisibility();
}
protected override void DisableProperties()
{
- GradientType.BaseValueChanged -= GradientTypeOnBaseValueChanged;
+ GradientType.CurrentValueSet -= GradientTypeOnCurrentValueSet;
if (ProfileElement is Layer layer)
- layer.General.ResizeMode.BaseValueChanged -= ResizeModeOnBaseValueChanged;
+ layer.General.ResizeMode.CurrentValueSet -= ResizeModeOnCurrentValueSet;
}
- private void GradientTypeOnBaseValueChanged(object sender, LayerPropertyEventArgs e)
+ private void GradientTypeOnCurrentValueSet(object sender, LayerPropertyEventArgs e)
{
UpdateVisibility();
}
- private void ResizeModeOnBaseValueChanged(object sender, LayerPropertyEventArgs e)
+ private void ResizeModeOnCurrentValueSet(object sender, LayerPropertyEventArgs e)
{
UpdateVisibility();
}
diff --git a/src/Plugins/Artemis.Plugins.LayerBrushes.Color/PropertyGroups/RadialGradientProperties.cs b/src/Plugins/Artemis.Plugins.LayerBrushes.Color/PropertyGroups/RadialGradientProperties.cs
index a09836988..09499cdb5 100644
--- a/src/Plugins/Artemis.Plugins.LayerBrushes.Color/PropertyGroups/RadialGradientProperties.cs
+++ b/src/Plugins/Artemis.Plugins.LayerBrushes.Color/PropertyGroups/RadialGradientProperties.cs
@@ -19,7 +19,7 @@ namespace Artemis.Plugins.LayerBrushes.Color.PropertyGroups
protected override void EnableProperties()
{
if (ProfileElement is Layer layer)
- layer.General.ResizeMode.BaseValueChanged += ResizeModeOnBaseValueChanged;
+ layer.General.ResizeMode.CurrentValueSet += ResizeModeOnCurrentValueSet;
UpdateVisibility();
}
@@ -27,10 +27,10 @@ namespace Artemis.Plugins.LayerBrushes.Color.PropertyGroups
protected override void DisableProperties()
{
if (ProfileElement is Layer layer)
- layer.General.ResizeMode.BaseValueChanged -= ResizeModeOnBaseValueChanged;
+ layer.General.ResizeMode.CurrentValueSet -= ResizeModeOnCurrentValueSet;
}
- private void ResizeModeOnBaseValueChanged(object sender, LayerPropertyEventArgs e)
+ private void ResizeModeOnCurrentValueSet(object sender, LayerPropertyEventArgs e)
{
UpdateVisibility();
}
diff --git a/src/Plugins/Artemis.Plugins.LayerBrushes.Noise/NoiseBrushProperties.cs b/src/Plugins/Artemis.Plugins.LayerBrushes.Noise/NoiseBrushProperties.cs
index 86607f93c..56d019230 100644
--- a/src/Plugins/Artemis.Plugins.LayerBrushes.Noise/NoiseBrushProperties.cs
+++ b/src/Plugins/Artemis.Plugins.LayerBrushes.Noise/NoiseBrushProperties.cs
@@ -44,12 +44,18 @@ namespace Artemis.Plugins.LayerBrushes.Noise
protected override void EnableProperties()
{
- ColorType.BaseValueChanged += (sender, args) => UpdateVisibility();
+ ColorType.CurrentValueSet += ColorTypeOnCurrentValueSet;
UpdateVisibility();
}
protected override void DisableProperties()
{
+ ColorType.CurrentValueSet -= ColorTypeOnCurrentValueSet;
+ }
+
+ private void ColorTypeOnCurrentValueSet(object sender, LayerPropertyEventArgs e)
+ {
+ UpdateVisibility();
}
private void UpdateVisibility()