mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-03-03 00:00:57 +08:00
69 lines
1.9 KiB
C#
69 lines
1.9 KiB
C#
|
|
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 BlockDesignerItemViewModel : DesignerItemViewModelBase
|
|||
|
|
{
|
|||
|
|
public BlockDesignerItemViewModel()
|
|||
|
|
{
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public BlockDesignerItemViewModel(IDiagramViewModel root) : base(root)
|
|||
|
|
{
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public BlockDesignerItemViewModel(IDiagramViewModel root, SelectableItemBase designer) : base(root, designer)
|
|||
|
|
{
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public BlockDesignerItemViewModel(IDiagramViewModel root, SerializableItem serializableItem, string serializableType) : base(root, serializableItem, serializableType)
|
|||
|
|
{
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
protected override void InitNew()
|
|||
|
|
{
|
|||
|
|
AddConnector(new BlockConnectorInfo(this.Root, this, ConnectorOrientation.Top));
|
|||
|
|
AddConnector(new BlockConnectorInfo(this.Root, this, ConnectorOrientation.Bottom));
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public BlockDesignerItemViewModel Next
|
|||
|
|
{
|
|||
|
|
get;set;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public void AddNext(BlockDesignerItemViewModel next)
|
|||
|
|
{
|
|||
|
|
next.Left = this.Left;
|
|||
|
|
next.Top = this.Top + this.ItemHeight;
|
|||
|
|
next.ParentId = this.Id;
|
|||
|
|
next.Parent = this;
|
|||
|
|
this.Next = next;
|
|||
|
|
if (next.Next != null)
|
|||
|
|
{
|
|||
|
|
next.AddNext(next.Next);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public override void AddToSelection(bool selected, bool clearother)
|
|||
|
|
{
|
|||
|
|
if (clearother)
|
|||
|
|
{
|
|||
|
|
foreach (SelectableDesignerItemViewModelBase item in Root.SelectedItems.ToList())
|
|||
|
|
{
|
|||
|
|
if (item != this)
|
|||
|
|
{
|
|||
|
|
item.RemoveFromSelection();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
IsSelected = selected;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|