mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-03-08 10:40:50 +08:00
block
This commit is contained in:
@@ -43,6 +43,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
AlignNext(next);
|
||||
return;
|
||||
}
|
||||
var oldnext = this.Next;
|
||||
RemoveNext();
|
||||
|
||||
next.Left = this.Left;
|
||||
@@ -54,6 +55,14 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
{
|
||||
next.AlignNext(next.Next);
|
||||
}
|
||||
if (oldnext != null)
|
||||
{
|
||||
System.Windows.Application.Current?.Dispatcher.BeginInvoke(new Action(async () => {
|
||||
await Task.Delay(10);
|
||||
GetLast().AddNext(oldnext);
|
||||
}));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void AlignNext(BlockDesignerItemViewModel next)
|
||||
@@ -97,7 +106,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
IsSelected = selected;
|
||||
}
|
||||
|
||||
public virtual void AddChild(BlockDesignerItemViewModel child)
|
||||
public virtual void AddChild(BlockDesignerItemViewModel child, BlockItemsContainerInfo container)
|
||||
{
|
||||
child.RemoveFromSelection();
|
||||
this.GetRootContainItem.AddToSelection(true, true);
|
||||
@@ -108,7 +117,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
}));
|
||||
}
|
||||
|
||||
public virtual void RemoveChild(BlockDesignerItemViewModel child)
|
||||
public virtual void RemoveChild(BlockDesignerItemViewModel child, BlockItemsContainerInfo container)
|
||||
{
|
||||
this.RemoveFromSelection();
|
||||
|
||||
@@ -120,6 +129,21 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
}));
|
||||
}
|
||||
|
||||
public int BlockLevel
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Prev == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Prev.BlockLevel + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public BlockDesignerItemViewModel Prev
|
||||
{
|
||||
get
|
||||
@@ -133,24 +157,45 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
get; set;
|
||||
}
|
||||
|
||||
public BlockItemsContainerInfo ParentContain
|
||||
public bool CanContainTo
|
||||
{
|
||||
get; set;
|
||||
} = true;
|
||||
|
||||
public BlockItemsContainerInfo ParentContainer
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
public ObservableCollection<BlockItemsContainerInfo> Contains
|
||||
public ObservableCollection<BlockItemsContainerInfo> Containers
|
||||
{
|
||||
get; set;
|
||||
} = new ObservableCollection<BlockItemsContainerInfo>();
|
||||
|
||||
public BlockItemsContainerInfo FirstContain
|
||||
public BlockItemsContainerInfo FirstContainer
|
||||
{
|
||||
get
|
||||
{
|
||||
return Contains?.FirstOrDefault();
|
||||
return Containers?.FirstOrDefault();
|
||||
}
|
||||
}
|
||||
|
||||
public BlockItemsContainerInfo SecondContainer
|
||||
{
|
||||
get
|
||||
{
|
||||
return Containers?.Skip(1)?.FirstOrDefault();
|
||||
}
|
||||
}
|
||||
|
||||
public BlockItemsContainerInfo ThirdContainer
|
||||
{
|
||||
get
|
||||
{
|
||||
return Containers?.Skip(2)?.FirstOrDefault();
|
||||
}
|
||||
}
|
||||
|
||||
public BlockDesignerItemViewModel GetFirst()
|
||||
{
|
||||
var parent = this.Next;
|
||||
@@ -179,20 +224,20 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
|
||||
public List<BlockItemsContainerInfo> GetAllContain()
|
||||
{
|
||||
return Contains.SelectMany(p => p.GetAllContain(p.Children, true)).ToList();
|
||||
return Containers.SelectMany(p => p.GetAllContain(p.Children, true)).ToList();
|
||||
}
|
||||
|
||||
public BlockDesignerItemViewModel GetRootContainItem
|
||||
{
|
||||
get
|
||||
{
|
||||
if (ParentContain == null)
|
||||
if (ParentContainer == null)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
else
|
||||
{
|
||||
return ParentContain.DataItem.GetRootContainItem;
|
||||
return ParentContainer.DataItem.GetRootContainItem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user