mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-03-14 21:46:37 +08:00
block
This commit is contained in:
@@ -134,16 +134,24 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
}
|
||||
}
|
||||
|
||||
private ObservableCollection<BlockDesignerItemViewModel> _children = new ObservableCollection<BlockDesignerItemViewModel>();
|
||||
public ObservableCollection<BlockDesignerItemViewModel> Children
|
||||
{
|
||||
get; set;
|
||||
} = new ObservableCollection<BlockDesignerItemViewModel>();
|
||||
get
|
||||
{
|
||||
return _children;
|
||||
}
|
||||
set
|
||||
{
|
||||
SetProperty(ref _children, value);
|
||||
}
|
||||
}
|
||||
|
||||
public List<BlockItemsContainerInfo> ChildrenContain
|
||||
{
|
||||
get
|
||||
{
|
||||
return Children?.SelectMany(p => p.Contains)?.ToList();
|
||||
return Children?.SelectMany(p => p.Containers)?.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,13 +159,13 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
{
|
||||
get
|
||||
{
|
||||
if (DataItem.ParentContain == null)
|
||||
if (DataItem.ParentContainer == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return DataItem.ParentContain.ContainLevel + 1;
|
||||
return DataItem.ParentContainer.ContainLevel + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -201,8 +209,8 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
}
|
||||
}
|
||||
|
||||
public virtual bool CanAttachTo(DesignerItemViewModelBase item)
|
||||
=> item != null && item != this.DataItem && !item.IsReadOnly && item is BlockDesignerItemViewModel;
|
||||
public virtual bool CanAttachTo(BlockDesignerItemViewModel item)
|
||||
=> item != null && item != this.DataItem && !item.IsReadOnly && item.CanContainTo;
|
||||
#endregion
|
||||
|
||||
public double GetItemWidth()
|
||||
@@ -217,13 +225,13 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
|
||||
public void AddChild(BlockDesignerItemViewModel child)
|
||||
{
|
||||
child.ParentContain = this;
|
||||
child.ParentContainer = this;
|
||||
Children.Add(child);
|
||||
}
|
||||
|
||||
public void RemoveChild(BlockDesignerItemViewModel child)
|
||||
{
|
||||
child.ParentContain = null;
|
||||
child.ParentContainer = null;
|
||||
Children.Remove(child);
|
||||
}
|
||||
|
||||
@@ -238,12 +246,12 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
{
|
||||
foreach (var item in children)
|
||||
{
|
||||
if (item.Contains != null)
|
||||
if (item.Containers != null)
|
||||
{
|
||||
foreach (var contain in item.Contains)
|
||||
foreach (var container in item.Containers)
|
||||
{
|
||||
itemsContainers.Add(contain);
|
||||
itemsContainers.AddRange(contain.GetAllContain(contain.Children, false));
|
||||
itemsContainers.Add(container);
|
||||
itemsContainers.AddRange(container.GetAllContain(container.Children, false));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user