画线调整

This commit is contained in:
艾竹
2023-01-16 22:38:58 +08:00
parent 718d8c01e9
commit f8a0b29d5f
2 changed files with 20 additions and 22 deletions

View File

@@ -37,6 +37,14 @@ namespace AIStudio.Wpf.DiagramDesigner
private void Init(FullyCreatedConnectorInfo sourceConnectorInfo, ConnectorInfoBase sinkConnectorInfo)
{
this.Parent = sourceConnectorInfo.DataItem.Parent;
if (Parent != null && Parent.ColorViewModel != null)
{
this.ColorViewModel = CopyHelper.Mapper(Parent.ColorViewModel);
}
if (sinkConnectorInfo is FullyCreatedConnectorInfo sink && sink.DataItem.ShowArrow == false)
{
this.ColorViewModel.RightArrowPathStyle = ArrowPathStyle.None;
}
var routetype = GlobalType.AllTypes.Where(p => typeof(IRouter).IsAssignableFrom(p)).FirstOrDefault(p => p.Name == RouterMode);
Router = routetype != null ? (System.Activator.CreateInstance(routetype) as IRouter) : new RouterNormal();
@@ -47,16 +55,7 @@ namespace AIStudio.Wpf.DiagramDesigner
this.SourceConnectorInfo = sourceConnectorInfo;
this.SinkConnectorInfo = sinkConnectorInfo;
DeleteConnectionCommand = new SimpleCommand(DeleteConnection);
AddVertexCommand = new SimpleCommand(AddVertex);
if (Parent != null && Parent.ColorViewModel != null)
{
this.ColorViewModel = CopyHelper.Mapper(Parent.ColorViewModel);
}
if (sinkConnectorInfo is FullyCreatedConnectorInfo sink && sink.DataItem.ShowArrow == false)
{
this.ColorViewModel.RightArrowPathStyle = ArrowPathStyle.None;
}
AddVertexCommand = new SimpleCommand(AddVertex);
}
public override SelectableDesignerItemBase ToXmlObject()
@@ -352,12 +351,13 @@ namespace AIStudio.Wpf.DiagramDesigner
var route = Router.Get(Parent, this);
(var source, var target) = FindConnectionPoints(route);
if (source == null || target == null)
return;
if (source == null || target == null)
return;
PathGeneratorResult = PathGenerator.Get(Parent, this, route, source.Value, target.Value);
StartPoint = PathGeneratorResult.SourceMarkerPosition;
EndPoint = PathGeneratorResult.TargetMarkerPosition;
StartPoint = new PointBase(source.Value.X - Area.Left, source.Value.Y - Area.Top);
EndPoint = new PointBase(target.Value.X - Area.Left, target.Value.Y - Area.Top);
StartAngle = PathGeneratorResult.SourceMarkerAngle;
EndAngle = PathGeneratorResult.TargetMarkerAngle;
}