mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-03-03 08:10:50 +08:00
Revert "Revert "block 可以拖拽到内部,还有少量问题待解决""
This reverts commit fcd7beb193.
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using AIStudio.Wpf.DiagramDesigner.Models;
|
||||
|
||||
namespace AIStudio.Wpf.DiagramDesigner
|
||||
{
|
||||
public class BlockContainDesignerItemViewModel : BlockDesignerItemViewModel
|
||||
{
|
||||
public BlockContainDesignerItemViewModel()
|
||||
{
|
||||
}
|
||||
|
||||
public BlockContainDesignerItemViewModel(IDiagramViewModel root) : base(root)
|
||||
{
|
||||
}
|
||||
|
||||
public BlockContainDesignerItemViewModel(IDiagramViewModel root, SelectableItemBase designer) : base(root, designer)
|
||||
{
|
||||
}
|
||||
|
||||
public BlockContainDesignerItemViewModel(IDiagramViewModel root, SerializableItem serializableItem, string serializableType) : base(root, serializableItem, serializableType)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void InitNew()
|
||||
{
|
||||
base.InitNew();
|
||||
|
||||
Contains.Add(new ItemsContainerInfo(this.Root, this));
|
||||
}
|
||||
|
||||
public override void AddChild(BlockDesignerItemViewModel child)
|
||||
{
|
||||
var oldchildren = FirstContain.Children.FirstOrDefault();
|
||||
if (oldchildren != null)
|
||||
{
|
||||
this.RemoveChild(oldchildren);
|
||||
}
|
||||
|
||||
Root.Items.Remove(child);
|
||||
FirstContain.Children.Add(child);
|
||||
|
||||
base.AddChild(child);
|
||||
}
|
||||
|
||||
public override void RemoveChild(BlockDesignerItemViewModel child)
|
||||
{
|
||||
Root.Items.Add(child);
|
||||
FirstContain.Children.Remove(child);
|
||||
|
||||
this.RemoveFromSelection();
|
||||
child.AddToSelection(true, false);
|
||||
|
||||
base.RemoveChild(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user