Revert "Revert "block 可以拖拽到内部,还有少量问题待解决""

This reverts commit fcd7beb193.
This commit is contained in:
艾竹
2023-06-11 23:58:22 +08:00
parent fcd7beb193
commit 5a9bcc03f3
73 changed files with 7132 additions and 242 deletions

View File

@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -27,28 +28,57 @@ namespace AIStudio.Wpf.DiagramDesigner
protected override void InitNew()
{
ItemWidth = double.NaN;
ItemHeight = double.NaN;
AddConnector(new BlockConnectorInfo(this.Root, this, ConnectorOrientation.Top));
AddConnector(new BlockConnectorInfo(this.Root, this, ConnectorOrientation.Bottom));
IsReadOnlyText = true;
}
public BlockDesignerItemViewModel Next
{
get;set;
get; set;
}
public void AddNext(BlockDesignerItemViewModel next)
{
this.ParentId = new Guid();
this.Parent = null;
next.Left = this.Left;
next.Top = this.Top + this.ItemHeight;
next.Top = this.Top + this.GetItemHeight();
next.ParentId = this.Id;
next.Parent = this;
this.Next = next;
if (next.Next != null)
//if (oldnext != null)
//{
// next.AddNext(oldnext);
//}
}
public void RemoveNext()
{
var next = this.Next;
if (next != null)
{
next.AddNext(next.Next);
next.ParentId = new Guid();
next.Parent = null;
this.Next = null;
}
}
public BlockDesignerItemViewModel GetLastNext()
{
var next = this.Next;
if (next != null)
{
while (next.Next != null)
{
next = next.Next;
}
}
return next;
}
public override void AddToSelection(bool selected, bool clearother)
{
if (clearother)
@@ -64,5 +94,31 @@ namespace AIStudio.Wpf.DiagramDesigner
IsSelected = selected;
}
public virtual void AddChild(BlockDesignerItemViewModel child)
{
child.RemoveFromSelection();
this.AddToSelection(true, false);
}
public virtual void RemoveChild(BlockDesignerItemViewModel child)
{
this.RemoveFromSelection();
child.AddToSelection(true, false);
}
public ObservableCollection<ItemsContainerInfo> Contains
{
get; set;
} = new ObservableCollection<ItemsContainerInfo>();
public ItemsContainerInfo FirstContain
{
get
{
return Contains?.FirstOrDefault();
}
}
}
}