Browse Source

Added 2 brushes, improved spacing

Krzysztof Krysiński 1 tuần trước cách đây
mục cha
commit
240d830179

+ 7 - 2
src/PixiEditor.ChangeableDocument/Changeables/Brushes/BrushEngine.cs

@@ -142,21 +142,26 @@ public class BrushEngine : IDisposable
 
         float strokeWidth = brushData.StrokeWidth;
         float spacing = brushNode.Spacing.Value / 100f;
+        int startingIndex = Math.Max(lastAppliedHistoryIndex, 0);
+        float spacingPressure = pointsHistory.Count < startingIndex + 1
+            ? (float)lastPressure
+            : pointsHistory[startingIndex].PointerInfo.Pressure;
 
         for (int i = Math.Max(lastAppliedHistoryIndex, 0); i < pointsHistory.Count; i++)
         {
             var point = pointsHistory[i];
 
-            float spacingPixels = (strokeWidth * point.PointerInfo.Pressure) * spacing;
+            float spacingPixels = (strokeWidth * spacingPressure) * spacing;
             if (VecD.Distance(lastPos, point.Position) < spacingPixels)
                 continue;
-            
 
             ExecuteVectorShapeBrush(target, brushNode, brushData, point.Position, frameTime, cs, samplingOptions,
                 point.PointerInfo,
                 point.KeyboardInfo,
                 point.EditorData);
 
+            spacingPressure = brushNode.Pressure.Value;
+
             lastPos = point.Position;
         }
 

BIN
src/PixiEditor/Data/Brushes/BasicFlowOpacity.pixi


BIN
src/PixiEditor/Data/Brushes/Texture.pixi