Portless序列化

This commit is contained in:
艾竹
2023-01-27 20:43:41 +08:00
parent e8bd6faa21
commit 6d1960a8df
9 changed files with 120 additions and 36 deletions

View File

@@ -10,16 +10,17 @@ namespace AIStudio.Wpf.DiagramDesigner
{
public class FullyCreatedConnectorInfo : ConnectorInfoBase
{
public FullyCreatedConnectorInfo(DesignerItemViewModelBase dataItem, ConnectorOrientation orientation, bool isInnerPoint = false, ValueTypePoint valueTypePoint = 0)
: this(null, dataItem, orientation, isInnerPoint, valueTypePoint)
public FullyCreatedConnectorInfo(DesignerItemViewModelBase dataItem, ConnectorOrientation orientation, bool isInnerPoint = false, bool isPortless = false, ValueTypePoint valueTypePoint = 0)
: this(null, dataItem, orientation, isInnerPoint, isPortless, valueTypePoint)
{
}
public FullyCreatedConnectorInfo(IDiagramViewModel root, DesignerItemViewModelBase dataItem, ConnectorOrientation orientation, bool isInnerPoint = false, ValueTypePoint valueTypePoint = 0)
public FullyCreatedConnectorInfo(IDiagramViewModel root, DesignerItemViewModelBase dataItem, ConnectorOrientation orientation, bool isInnerPoint = false, bool isPortless = false, ValueTypePoint valueTypePoint = 0)
: base(root, orientation)
{
this.Parent = dataItem;
this.IsInnerPoint = isInnerPoint;
this.IsPortless = IsPortless;
this.ValueTypePoint = valueTypePoint;
if (IsInnerPoint == true)
{
@@ -69,6 +70,7 @@ namespace AIStudio.Wpf.DiagramDesigner
XRatio = designer.XRatio;
YRatio = designer.YRatio;
IsInnerPoint = designer.IsInnerPoint;
IsPortless = designer.IsPortless;
ValueTypePoint = designer.ValueTypePoint;
}
}
@@ -231,18 +233,30 @@ namespace AIStudio.Wpf.DiagramDesigner
{
return XRatio;
}
else if (IsPortless)
{
return 0.5;
}
else
{
switch (Orientation)
{
case ConnectorOrientation.Top:
return 0.5;
case ConnectorOrientation.Left:
return 0;
case ConnectorOrientation.Bottom:
case ConnectorOrientation.TopLeft:
return 0;
case ConnectorOrientation.Top:
return 0.5;
case ConnectorOrientation.TopRight:
return 1;
case ConnectorOrientation.Right:
return 1;
case ConnectorOrientation.BottomRight:
return 1;
case ConnectorOrientation.Bottom:
return 0.5;
case ConnectorOrientation.BottomLeft:
return 0;
default: return XRatio;
}
}
@@ -254,18 +268,30 @@ namespace AIStudio.Wpf.DiagramDesigner
{
return YRatio;
}
else if (IsPortless)
{
return 0.5;
}
else
{
switch (Orientation)
{
case ConnectorOrientation.Top:
return 0;
case ConnectorOrientation.Left:
return 0.5;
case ConnectorOrientation.Bottom:
return 1;
case ConnectorOrientation.TopLeft:
return 0;
case ConnectorOrientation.Top:
return 0;
case ConnectorOrientation.TopRight:
return 0;
case ConnectorOrientation.Right:
return 0.5;
case ConnectorOrientation.BottomRight:
return 1;
case ConnectorOrientation.Bottom:
return 1;
case ConnectorOrientation.BottomLeft:
return 1;
default: return YRatio;
}
}