mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-04-09 02:36:35 +08:00
group 和 line 优化
This commit is contained in:
@@ -3,7 +3,9 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Controls;
|
||||
using AIStudio.Wpf.DiagramDesigner;
|
||||
using AIStudio.Wpf.DiagramDesigner.Geometrys;
|
||||
using AIStudio.Wpf.DiagramDesigner.Models;
|
||||
|
||||
namespace AIStudio.Wpf.DiagramDesigner
|
||||
@@ -12,7 +14,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
{
|
||||
public GroupDesignerItemViewModel() : this(null)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
public GroupDesignerItemViewModel(IDiagramViewModel root) : base(root)
|
||||
@@ -34,6 +36,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
{
|
||||
base.Init(root);
|
||||
|
||||
this.IsGroup = true;
|
||||
this.IsHitTestVisible = true;
|
||||
}
|
||||
|
||||
@@ -46,6 +49,32 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
{
|
||||
}
|
||||
|
||||
public void Resize()
|
||||
{
|
||||
if (this.Root == null) return;
|
||||
|
||||
var items = this.Root.Items.Where(p => p.ParentId == Id).OfType<DesignerItemViewModelBase>();
|
||||
RectangleBase rect = DiagramViewModelHelper.GetBoundingRectangle(items);
|
||||
|
||||
this.ItemWidth = rect.Width;
|
||||
this.ItemHeight = rect.Height;
|
||||
this.Left = rect.Left;
|
||||
this.Top = rect.Top;
|
||||
}
|
||||
|
||||
public void AddItem(DesignerItemViewModelBase item)
|
||||
{
|
||||
if (this.Root == null) return;
|
||||
|
||||
item.ParentId = Id;
|
||||
if (item.ZIndex > this.ZIndex)
|
||||
{
|
||||
var zindex = item.ZIndex;
|
||||
item.ZIndex = this.ZIndex;
|
||||
this.ZIndex = zindex;
|
||||
}
|
||||
Resize();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 打标记使用
|
||||
|
||||
Reference in New Issue
Block a user