mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-03-03 00:00:57 +08:00
block
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user