|
@@ -98,9 +98,9 @@ internal class VectorPathToolExecutor : UpdateableChangeExecutor, IPathExecutorF
|
|
|
}
|
|
|
|
|
|
//below forces undo before starting new path
|
|
|
- // internals.ActionAccumulator.AddFinishedActions(new EndSetShapeGeometry_Action());
|
|
|
+ // internals.ActionAccumulator.AddFinishedActions(new EndSetShapeGeometry_Action());
|
|
|
|
|
|
- // internals.ActionAccumulator.AddActions(new SetShapeGeometry_Action(member.Id, ConstructShapeData(startingPath)));
|
|
|
+ // internals.ActionAccumulator.AddActions(new SetShapeGeometry_Action(member.Id, ConstructShapeData(startingPath)));
|
|
|
}
|
|
|
}
|
|
|
else
|
|
@@ -150,11 +150,11 @@ internal class VectorPathToolExecutor : UpdateableChangeExecutor, IPathExecutorF
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
private bool WholePathClosed()
|
|
|
{
|
|
|
EditableVectorPath editablePath = new EditableVectorPath(startingPath);
|
|
|
-
|
|
|
+
|
|
|
return editablePath.SubShapes.Count > 0 && editablePath.SubShapes.All(x => x.IsClosed);
|
|
|
}
|
|
|
|
|
@@ -176,7 +176,9 @@ internal class VectorPathToolExecutor : UpdateableChangeExecutor, IPathExecutorF
|
|
|
{
|
|
|
if (document.PathOverlayHandler.IsActive)
|
|
|
{
|
|
|
- internals.ActionAccumulator.AddFinishedActions(new SetShapeGeometry_Action(member.Id, ConstructShapeData(startingPath)), new EndSetShapeGeometry_Action());
|
|
|
+ internals.ActionAccumulator.AddFinishedActions(
|
|
|
+ new SetShapeGeometry_Action(member.Id, ConstructShapeData(startingPath)),
|
|
|
+ new EndSetShapeGeometry_Action());
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -198,7 +200,7 @@ internal class VectorPathToolExecutor : UpdateableChangeExecutor, IPathExecutorF
|
|
|
|
|
|
private PathVectorData ConstructShapeData(VectorPath? path)
|
|
|
{
|
|
|
- if(path is null)
|
|
|
+ if (path is null)
|
|
|
{
|
|
|
return new PathVectorData(new VectorPath() { FillType = (PathFillType)vectorPathToolHandler.FillMode })
|
|
|
{
|
|
@@ -210,7 +212,7 @@ internal class VectorPathToolExecutor : UpdateableChangeExecutor, IPathExecutorF
|
|
|
StrokeLineJoin = vectorPathToolHandler.StrokeLineJoin
|
|
|
};
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
return new PathVectorData(new VectorPath(path) { FillType = (PathFillType)vectorPathToolHandler.FillMode })
|
|
|
{
|
|
|
StrokeWidth = (float)toolbar.ToolSize,
|
|
@@ -227,19 +229,17 @@ internal class VectorPathToolExecutor : UpdateableChangeExecutor, IPathExecutorF
|
|
|
if (document.PathOverlayHandler.IsActive)
|
|
|
{
|
|
|
startingPath = path;
|
|
|
- internals.ActionAccumulator.AddActions(new SetShapeGeometry_Action(member.Id, ConstructShapeData(startingPath)));
|
|
|
+ internals.ActionAccumulator.AddActions(new SetShapeGeometry_Action(member.Id,
|
|
|
+ ConstructShapeData(startingPath)));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public bool IsFeatureEnabled(IExecutorFeature feature)
|
|
|
+ public bool IsFeatureEnabled<T>()
|
|
|
{
|
|
|
- return feature switch
|
|
|
- {
|
|
|
- IPathExecutorFeature _ => true,
|
|
|
- IMidChangeUndoableExecutor _ => true,
|
|
|
- ITransformableExecutor _ => true,
|
|
|
- _ => false
|
|
|
- };
|
|
|
+ Type feature = typeof(T);
|
|
|
+ return feature == typeof(IMidChangeUndoableExecutor)
|
|
|
+ || feature == typeof(ITransformableExecutor)
|
|
|
+ || feature == typeof(IPathExecutorFeature);
|
|
|
}
|
|
|
|
|
|
protected void HighlightSnapping(string? snapX, string? snapY)
|
|
@@ -259,7 +259,7 @@ internal class VectorPathToolExecutor : UpdateableChangeExecutor, IPathExecutorF
|
|
|
|
|
|
return shapeData is not IReadOnlyPathData pathData || pathData.Path.IsClosed;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
private void ApplySettings(PathVectorData pathData)
|
|
|
{
|
|
|
toolbar.ToolSize = pathData.StrokeWidth;
|
|
@@ -267,8 +267,11 @@ internal class VectorPathToolExecutor : UpdateableChangeExecutor, IPathExecutorF
|
|
|
toolbar.ToolSize = pathData.StrokeWidth;
|
|
|
toolbar.Fill = pathData.Fill;
|
|
|
toolbar.FillBrush = pathData.FillPaintable.ToBrush();
|
|
|
- toolbar.GetSetting<EnumSettingViewModel<VectorPathFillType>>(nameof(VectorPathToolViewModel.FillMode)).Value = (VectorPathFillType)pathData.Path.FillType;
|
|
|
- toolbar.GetSetting<EnumSettingViewModel<StrokeCap>>(nameof(VectorPathToolViewModel.StrokeLineCap)).Value = pathData.StrokeLineCap;
|
|
|
- toolbar.GetSetting<EnumSettingViewModel<StrokeJoin>>(nameof(VectorPathToolViewModel.StrokeLineJoin)).Value = pathData.StrokeLineJoin;
|
|
|
+ toolbar.GetSetting<EnumSettingViewModel<VectorPathFillType>>(nameof(VectorPathToolViewModel.FillMode)).Value =
|
|
|
+ (VectorPathFillType)pathData.Path.FillType;
|
|
|
+ toolbar.GetSetting<EnumSettingViewModel<StrokeCap>>(nameof(VectorPathToolViewModel.StrokeLineCap)).Value =
|
|
|
+ pathData.StrokeLineCap;
|
|
|
+ toolbar.GetSetting<EnumSettingViewModel<StrokeJoin>>(nameof(VectorPathToolViewModel.StrokeLineJoin)).Value =
|
|
|
+ pathData.StrokeLineJoin;
|
|
|
}
|
|
|
}
|