瀏覽代碼

fixed bool op not using custom caps and joins

Krzysztof Krysiński 3 月之前
父節點
當前提交
83cd6b4e47

+ 19 - 1
src/PixiEditor.ChangeableDocument/Changeables/Graph/Nodes/Shapes/BoolOperationNode.cs

@@ -1,4 +1,5 @@
-using Drawie.Backend.Core.Vector;
+using Drawie.Backend.Core.Surfaces.PaintImpl;
+using Drawie.Backend.Core.Vector;
 using PixiEditor.ChangeableDocument.Changeables.Graph.Nodes.Shapes.Data;
 using PixiEditor.ChangeableDocument.Rendering;
 
@@ -45,12 +46,29 @@ public class BoolOperationNode : Node
         ShapeVectorData shapeA = ShapeA.Value;
         ShapeVectorData shapeB = ShapeB.Value;
 
+        StrokeCap cap = StrokeCap.Round;
+        StrokeJoin join = StrokeJoin.Round;
+        PathFillType fillType = PathFillType.Winding;
+
+        if (shapeA is PathVectorData pathA)
+        {
+            cap = pathA.StrokeLineCap;
+            join = pathA.StrokeLineJoin;
+        }
+        else if (shapeB is PathVectorData pathB)
+        {
+            cap = pathB.StrokeLineCap;
+            join = pathB.StrokeLineJoin;
+        }
+
         Result.Value = new PathVectorData(shapeA.ToPath(true).Op(shapeB.ToPath(true), Operation.Value))
         {
             Fill = shapeA.Fill,
             Stroke = shapeA.Stroke,
             StrokeWidth = shapeA.StrokeWidth,
             FillPaintable = shapeA.FillPaintable,
+            StrokeLineCap = cap,
+            StrokeLineJoin = join,
         };
     }
 

+ 5 - 0
tests/PixiEditor.Backend.Tests/MockDocument.cs

@@ -84,4 +84,9 @@ public class MockDocument : IReadOnlyDocument
     {
         throw new NotImplementedException();
     }
+
+    public ICrossDocumentPipe<T> CreateNodePipe<T>(Guid layerId) where T : class, IReadOnlyNode
+    {
+        throw new NotImplementedException();
+    }
 }