添加节点可删除

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

@@ -14,6 +14,8 @@ namespace AIStudio.Wpf.DiagramDesigner
Offset = offset ?? new PointBase();
FontViewModel = Parent.FontViewModel;
ColorViewModel = Parent.ColorViewModel;
DeleteLabelCommand = new SimpleCommand(DeleteLabel);
}
public ConnectorViewModel Parent
@@ -78,16 +80,11 @@ namespace AIStudio.Wpf.DiagramDesigner
}
}
public override PointBase Position
public SimpleCommand DeleteLabelCommand
{
get
{
return new PointBase(Parent.Area.Left + Left, Parent.Area.Top + Top);
}
get; set;
}
public override PointBase MiddlePosition => new PointBase(Parent.Area.Left + Left + ConnectorWidth / 2, Parent.Area.Top + Top + ConnectorHeight / 2);
private bool updating = false;
public void UpdatePosition(SvgPath[] paths)
@@ -167,5 +164,13 @@ namespace AIStudio.Wpf.DiagramDesigner
}
}
private void DeleteLabel(object parameter)
{
if (parameter is ConnectorLabelModel label)
{
Parent.Labels.Remove(label);
}
}
}
}