mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-03-03 00:00:57 +08:00
block
This commit is contained in:
@@ -130,9 +130,34 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
{
|
||||
this.RemoveChild(oldchildren, container);
|
||||
}
|
||||
Root.Items.Remove(child);
|
||||
if (child.Prev != null)
|
||||
{
|
||||
child.Prev.RemoveNext();
|
||||
}
|
||||
if (child.Next != null)
|
||||
{
|
||||
child.RemoveNext();
|
||||
}
|
||||
container.InsertChild(child, index);
|
||||
}
|
||||
else
|
||||
{
|
||||
var list = child.GetNexts(true);
|
||||
list.Reverse();
|
||||
list.ForEach(p => {
|
||||
Root.Items.Remove(p);
|
||||
if (p.Prev != null)
|
||||
{
|
||||
p.Prev.RemoveNext();
|
||||
}
|
||||
if (p.Next != null)
|
||||
{
|
||||
p.RemoveNext();
|
||||
}
|
||||
container.InsertChild(p, index);
|
||||
});
|
||||
}
|
||||
Root.Items.Remove(child);
|
||||
container.InsertChild(child, index);
|
||||
|
||||
child.RemoveFromSelection();
|
||||
this.GetRootContainItem.AddToSelection(true, true);
|
||||
@@ -237,28 +262,44 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
|
||||
public BlockDesignerItemViewModel GetFirst()
|
||||
{
|
||||
var parent = this.Next;
|
||||
if (parent != null)
|
||||
var parent = this.Prev;
|
||||
while (parent?.Prev != null)
|
||||
{
|
||||
while (parent.Prev != null)
|
||||
{
|
||||
parent = Prev;
|
||||
}
|
||||
parent = parent.Prev;
|
||||
}
|
||||
|
||||
return parent;
|
||||
}
|
||||
|
||||
public BlockDesignerItemViewModel GetLast()
|
||||
{
|
||||
var next = this;
|
||||
if (next != null)
|
||||
while (next.Next != null)
|
||||
{
|
||||
while (next.Next != null)
|
||||
next = next.Next;
|
||||
}
|
||||
|
||||
return next;
|
||||
}
|
||||
|
||||
public List<BlockDesignerItemViewModel> GetNexts(bool self)
|
||||
{
|
||||
List<BlockDesignerItemViewModel> blockDesignerItemViewModels = new List<BlockDesignerItemViewModel>();
|
||||
if (self)
|
||||
{
|
||||
blockDesignerItemViewModels.Add(this);
|
||||
}
|
||||
var next = this;
|
||||
while (next != null)
|
||||
{
|
||||
next = next.Next;
|
||||
if (next != null)
|
||||
{
|
||||
next = next.Next;
|
||||
blockDesignerItemViewModels.Add(next);
|
||||
}
|
||||
}
|
||||
return next;
|
||||
|
||||
return blockDesignerItemViewModels;
|
||||
}
|
||||
|
||||
public void AddContainer(BlockItemsContainerInfo container)
|
||||
@@ -404,12 +445,12 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
{
|
||||
List<BlockDesignerItemTempLink> links = new List<BlockDesignerItemTempLink>();
|
||||
foreach (var block in blocks.OrderBy(p => p.BlockLevel).ToList())
|
||||
{
|
||||
{
|
||||
bool success = false;
|
||||
foreach (var link in links)
|
||||
{
|
||||
if (link.Items.LastOrDefault() == block.Prev)
|
||||
{
|
||||
{
|
||||
link.Items.Add(block);
|
||||
success = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user