diff --git a/src/Artemis.UI.Shared/Screens/GradientEditor/GradientEditorView.xaml b/src/Artemis.UI.Shared/Screens/GradientEditor/GradientEditorView.xaml index 2d8a50a73..32236519e 100644 --- a/src/Artemis.UI.Shared/Screens/GradientEditor/GradientEditorView.xaml +++ b/src/Artemis.UI.Shared/Screens/GradientEditor/GradientEditorView.xaml @@ -12,8 +12,8 @@ Background="{DynamicResource MaterialDesignPaper}" FontFamily="pack://application:,,,/MaterialDesignThemes.Wpf;component/Resources/Roboto/#Roboto" Width="400" - Height="425" - d:DesignHeight="425" + Height="450" + d:DesignHeight="450" d:DesignWidth="400" d:DataContext="{d:DesignInstance local:GradientEditorViewModel}"> @@ -90,41 +90,66 @@ - + + + + + + Selected stop: @@ -135,7 +160,7 @@ - + - x.OffsetFloat).Last(); + + if (stop == SelectedColorStopViewModel) SelectColorStop(null); + + ColorStopViewModels.Remove(stop); + ColorGradient.Remove(stop.ColorStop); + + // Distribute the stops if there is still more than one + if (ColorGradient.Count > 1) + SpreadColorStops(); + } + else + { + // Add a stop to the end that is the same color as the first stop + ColorGradientStop stop = new(ColorGradient.First().Color, 100); + ColorGradient.Add(stop); + + ColorStopViewModel viewModel = new(this, stop); + ColorStopViewModels.Add(viewModel); + + NotifyOfPropertyChange(nameof(HasMoreThanOneStop)); + + // Distribute the stops + SpreadColorStops(); + } + } + public void ClearGradient() + { + ColorGradient.Clear(); + ColorStopViewModels.Clear(); + } + public Point GetPositionInPreview(object sender, MouseEventArgs e) { Canvas? parent = VisualTreeUtilities.FindParent((DependencyObject) sender, null);