mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-03-03 00:00:57 +08:00
46 lines
1.1 KiB
C#
46 lines
1.1 KiB
C#
using AIStudio.Wpf.DiagramDesigner.Geometrys;
|
|
|
|
namespace AIStudio.Wpf.DiagramDesigner
|
|
{
|
|
public class ConnectorVertexModel : ConnectorPoint
|
|
{
|
|
public ConnectorVertexModel(ConnectorViewModel parent, PointBase? position = null)
|
|
{
|
|
Parent = parent;
|
|
X = position?.X ?? 0;
|
|
Y = position?.Y ?? 0;
|
|
|
|
DeleteVertexCommand = new SimpleCommand(DeleteVertex);
|
|
}
|
|
|
|
public ConnectorViewModel Parent
|
|
{
|
|
get;
|
|
}
|
|
|
|
public override PointBase Position
|
|
{
|
|
get
|
|
{
|
|
return new PointBase(Parent.Area.Left + Left, Parent.Area.Top + Top);
|
|
}
|
|
}
|
|
|
|
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);
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|