部分连接线拖拽完成

This commit is contained in:
艾竹
2023-05-03 09:59:46 +08:00
parent 6de36f2473
commit 1536e5018d
33 changed files with 997 additions and 158 deletions

View File

@@ -33,8 +33,8 @@ namespace AIStudio.Wpf.DiagramDesigner
private static PointBase[] GetRouteWithMiddlePoints(IDiagramViewModel _, ConnectionViewModel link, PointBase[] route)
{
var middle = GetMiddlePoints(
link.SourceConnectorInfo.MiddlePosition,
link.SourceConnectorInfo.Orientation,
link.SourceConnectorInfoFully.MiddlePosition,
link.SourceConnectorInfoFully.Orientation,
link.SinkConnectorInfo.MiddlePosition,
link.IsFullConnection ? link.SinkConnectorInfoFully.Orientation : (link.SinkConnectorInfo.MiddlePosition.Y >= link.SourceConnectorInfo.MiddlePosition.Y ? ConnectorOrientation.Top : ConnectorOrientation.Bottom),
_.GridCellSize,

View File

@@ -37,10 +37,10 @@ namespace AIStudio.Wpf.DiagramDesigner
private static PointBase[] GetRouteWithFullConnectionLine(IDiagramViewModel _, ConnectionViewModel link, PointBase[] route)
{
var sourceInnerPoint = link.SourceConnectorInfo.IsInnerPoint;
PointBase sourcePoint = link.SourceConnectorInfo.MiddlePosition;
var sourceInnerPoint = link.SourceConnectorInfoFully.IsInnerPoint;
PointBase sourcePoint = link.SourceConnectorInfoFully.MiddlePosition;
PointBase sinkPoint = link.SinkConnectorInfo.MiddlePosition;
ConnectorOrientation sourceOrientation = link.SourceConnectorInfo.Orientation;
ConnectorOrientation sourceOrientation = link.SourceConnectorInfoFully.Orientation;
ConnectorOrientation sinkOrientation = link.SinkConnectorInfoFully.Orientation;
List<PointBase> linePoints = new List<PointBase>();
@@ -242,7 +242,7 @@ namespace AIStudio.Wpf.DiagramDesigner
private static PointBase[] GetRouteWithPartConnectionLine(IDiagramViewModel diagramViewModel, ConnectionViewModel link, PointBase[] route)
{
var sourceInnerPoint = link.SourceConnectorInfo.IsInnerPoint;
var sourceInnerPoint = link.SourceConnectorInfoFully?.IsInnerPoint ?? false;
PointBase sourcePoint = link.SourceConnectorInfo.MiddlePosition;
PointBase sinkPoint = link.SinkConnectorInfo.MiddlePosition;
ConnectorOrientation sourceOrientation = link.SourceConnectorInfo.Orientation;
@@ -301,8 +301,8 @@ namespace AIStudio.Wpf.DiagramDesigner
linePoints = OptimizeLinePoints(linePoints, new RectangleBase[] { rectSource }, sourceOrientation, preferredOrientation);
else
linePoints = OptimizeLinePoints(linePoints, new RectangleBase[] { rectSource }, sourceOrientation, GetOpositeOrientation(sourceOrientation));
linePoints.Insert(0, sourcePoint);
linePoints.Insert(0, sourcePoint);
return linePoints.ToArray();
}

View File

@@ -70,7 +70,7 @@ namespace AIStudio.Wpf.DiagramDesigner
var cX = (route[0].X + route[1].X) / 2;
var cY = (route[0].Y + route[1].Y) / 2;
var sourceOrientation = link.SourceConnectorInfo?.Orientation;
var sourceOrientation = link.SourceConnectorInfo.Orientation;
if (sourceOrientation == ConnectorOrientation.None)//按照线条的四象限来处理。
{
var slope = (route[1].Y - route[0].Y) / (route[1].X - route[0].X);