Quellcode durchsuchen

avalonia: ImageEditor: Added borders around shapes

Kenric Nugteren vor 2 Wochen
Ursprung
Commit
f4a5637efd

+ 1 - 1
InABox.Avalonia/Components/ImageEditor/ImageEditor.axaml

@@ -52,7 +52,7 @@
 								 Margin="10"
 								 HorizontalAlignment="Center" VerticalAlignment="Center"
 								 Fill="{Binding $parent[components:ImageEditor].PrimaryBrush}"
-								 Stroke="Transparent"/>
+								 Stroke="Black" StrokeThickness="1"/>
 						<Button.Flyout>
 							<Flyout Placement="Top" VerticalOffset="-5">
 								<ColorView Color="{Binding $parent[components:ImageEditor].PrimaryBrush,Converter={x:Static converters:BrushToColorConverter.Instance}}"/>

+ 12 - 8
InABox.Avalonia/Components/ImageEditor/ImageEditor.axaml.cs

@@ -89,14 +89,18 @@ public partial class ImageEditor : UserControl
         switch (mode)
         {
             case ImageEditingMode.Polyline:
-                var line = new Polyline
-                {
-                    Points = [new(0, 0), new(20, 8), new(5, 16), new(25, 25)],
-                    Width = 25,
-                    Height = 25
-                };
-                line.Bind(Polyline.StrokeProperty, new Binding(nameof(PrimaryBrush)) { Source = this });
-                ShapeButton.Content = line;
+                var canvas = new Canvas();
+                var points = new Point[] { new(0, 0), new(20, 8), new(5, 16), new(25, 25) };
+                var line1 = new Polyline { Points = points, Width = 25, Height = 25 };
+                var line2 = new Polyline { Points = points, Width = 25, Height = 25 };
+                line1.StrokeThickness = 4;
+                line1.StrokeLineCap = PenLineCap.Round;
+                line2.StrokeThickness = 1.5;
+                line1.Stroke = new SolidColorBrush(Colors.Black);
+                line2.Bind(Polyline.StrokeProperty, new Binding(nameof(PrimaryBrush)) { Source = this });
+                canvas.Children.Add(line1);
+                canvas.Children.Add(line2);
+                ShapeButton.Content = canvas;
                 break;
         }
     }