添加节点可删除

This commit is contained in:
艾竹
2023-01-23 15:43:44 +08:00
parent bb2882c618
commit 2c76aacc66
13 changed files with 158 additions and 45 deletions

View File

@@ -9,6 +9,8 @@ namespace AIStudio.Wpf.DiagramDesigner
Parent = parent;
X = position?.X ?? 0;
Y = position?.Y ?? 0;
DeleteVertexCommand = new SimpleCommand(DeleteVertex);
}
public ConnectorViewModel Parent
@@ -26,5 +28,18 @@ namespace AIStudio.Wpf.DiagramDesigner
public override PointBase MiddlePosition => new PointBase(Parent.Area.Left + Left + ConnectorWidth / 2, Parent.Area.Top + Top + ConnectorHeight / 2);
public SimpleCommand DeleteVertexCommand
{
get; set;
}
private void DeleteVertex(object parameter)
{
if (parameter is ConnectorVertexModel vertice)
{
Parent.Vertices.Remove(vertice);
}
}
}
}