This commit is contained in:
艾竹
2023-06-27 22:57:08 +08:00
parent 6995fe1476
commit d2e00c6149
8 changed files with 70 additions and 73 deletions

View File

@@ -53,29 +53,6 @@ namespace AIStudio.Wpf.DiagramDesigner
}
}
public override PointBase Position
{
get
{
if (DataItem?.ParentContainer == null)
{
return PointHelper.GetPointForConnector(this);
}
else
{
return PointHelper.GetPointForConnector(this);//Todo
}
}
}
public override PointBase MiddlePosition
{
get
{
return PointHelper.GetPointForConnector(this, true);
}
}
public override bool CanAttachTo(ConnectorInfoBase port)
{
if (port is BlockConnectorInfo blockConnectorInfo)

View File

@@ -137,27 +137,18 @@ namespace AIStudio.Wpf.DiagramDesigner
var offset = GetOffSetFunc?.Invoke() ?? new Point(0, 0);
var containBound = new RectangleBase(DataItem.Left + offset.X, DataItem.Top + offset.Y, GetItemWidth(), GetItemHeight());
double height = 0;
foreach (var child in Children)
{
child.Left = DataItem.Left + offset.X;
child.Top = DataItem.Top + offset.Y + height;
height += child.GetItemHeight();
}
return containBound;
}
public List<RectangleBase> GetChildrenBounds()
{
List<RectangleBase> bounds = new List<RectangleBase>();
var offset = GetOffSetFunc?.Invoke() ?? new Point(0, 0);
var containBound = new RectangleBase(DataItem.Left + offset.X, DataItem.Top + offset.Y, GetItemWidth(), GetItemHeight());
double height = 0;
foreach (var child in Children)
{
var bound = new RectangleBase(DataItem.Left + offset.X, DataItem.Top + offset.Y + height, child.GetItemWidth(), child.GetItemHeight());
bounds.Add(bound);
height += child.GetItemHeight();
}
return bounds;
}
public BlockDesignerItemViewModel DataItem
{
@@ -184,7 +175,7 @@ namespace AIStudio.Wpf.DiagramDesigner
{
get
{
return Children?.SelectMany(p => p.Containers)?.ToList();
return Children.SelectMany(p => p.Containers)?.ToList();
}
}
@@ -256,10 +247,10 @@ namespace AIStudio.Wpf.DiagramDesigner
return double.IsNaN(ItemHeight) ? ActualItemHeight : ItemHeight;
}
public void AddChild(BlockDesignerItemViewModel child)
public void InsertChild(BlockDesignerItemViewModel child, int index)
{
child.ParentContainer = this;
Children.Add(child);
Children.Insert(index, child);
}
public void RemoveChild(BlockDesignerItemViewModel child)