mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-03-03 00:00:57 +08:00
Revert "Revert "block 可以拖拽到内部,还有少量问题待解决""
This reverts commit fcd7beb193.
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user