mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-04-09 10:46:37 +08:00
添加节点可删除
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user