mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-03-03 00:00:57 +08:00
block使用linklist重写,把代码复杂度降低点
This commit is contained in:
@@ -369,15 +369,15 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
}
|
||||
set
|
||||
{
|
||||
if (Root?.DiagramOption?.LayoutOption?.BeyondBoundary > 0)
|
||||
if (Root != null && BeyondBoundary > 0)
|
||||
{
|
||||
if (value + GetItemWidth() < Root.DiagramOption.LayoutOption.BeyondBoundary)
|
||||
if (value + GetItemWidth() < BeyondBoundary)
|
||||
{
|
||||
value = Root.DiagramOption.LayoutOption.BeyondBoundary - GetItemWidth();
|
||||
value = BeyondBoundary - GetItemWidth();
|
||||
}
|
||||
else if (value > Root.DiagramOption.LayoutOption.PageSize.Width - Root.DiagramOption.LayoutOption.BeyondBoundary)
|
||||
else if (value > Root.DiagramOption.LayoutOption.PageSize.Width - BeyondBoundary)
|
||||
{
|
||||
value = Root.DiagramOption.LayoutOption.PageSize.Width - Root.DiagramOption.LayoutOption.BeyondBoundary;
|
||||
value = Root.DiagramOption.LayoutOption.PageSize.Width - BeyondBoundary;
|
||||
}
|
||||
}
|
||||
SetProperty(ref _left, value);
|
||||
@@ -395,15 +395,15 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
}
|
||||
set
|
||||
{
|
||||
if (Root?.DiagramOption?.LayoutOption?.BeyondBoundary > 0)
|
||||
if (Root != null && BeyondBoundary > 0)
|
||||
{
|
||||
if (value + GetItemHeight() < Root.DiagramOption.LayoutOption.BeyondBoundary)
|
||||
if (value + GetItemHeight() < BeyondBoundary)
|
||||
{
|
||||
value = Root.DiagramOption.LayoutOption.BeyondBoundary - GetItemHeight();
|
||||
value = BeyondBoundary - GetItemHeight();
|
||||
}
|
||||
else if (value > Root.DiagramOption.LayoutOption.PageSize.Height - Root.DiagramOption.LayoutOption.BeyondBoundary)
|
||||
else if (value > Root.DiagramOption.LayoutOption.PageSize.Height - BeyondBoundary)
|
||||
{
|
||||
value = Root.DiagramOption.LayoutOption.PageSize.Height - Root.DiagramOption.LayoutOption.BeyondBoundary;
|
||||
value = Root.DiagramOption.LayoutOption.PageSize.Height - BeyondBoundary;
|
||||
}
|
||||
}
|
||||
SetProperty(ref _top, value);
|
||||
@@ -603,6 +603,11 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
}
|
||||
}
|
||||
|
||||
public double BeyondBoundary
|
||||
{
|
||||
get; set;
|
||||
} = -1;
|
||||
|
||||
/// <summary>
|
||||
/// 连接点是否可以按偏移自定义
|
||||
/// </summary>
|
||||
@@ -809,7 +814,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{Id}-{Name}-{Text}-({Left},{Top},{ItemWidth},{ItemHeight})";
|
||||
return $"{ParentId}-{Id}-{Name}-{Text}-({Left},{Top},{ItemWidth},{ItemHeight})";
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -370,11 +370,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
{
|
||||
get; set;
|
||||
} = true;
|
||||
|
||||
public double BeyondBoundary
|
||||
{
|
||||
get; set;
|
||||
} = -1;
|
||||
|
||||
}
|
||||
|
||||
public class SnappingOption
|
||||
|
||||
@@ -1226,11 +1226,14 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
item.Id = Guid.NewGuid();
|
||||
}
|
||||
|
||||
var logical = item as LogicalGateItemViewModelBase;
|
||||
if (logical != null)
|
||||
if (item is LogicalGateItemViewModelBase logical)
|
||||
{
|
||||
logical.OrderNumber = Items.OfType<LogicalGateItemViewModelBase>().Count() + 1;
|
||||
}
|
||||
//if (item is BlockDesignerItemViewModel block)
|
||||
//{
|
||||
// block.Text = block.Text + item.ZIndex;
|
||||
//}
|
||||
|
||||
var designerItemViewModelBase = item as DesignerItemViewModelBase;
|
||||
if (designerItemViewModelBase != null)
|
||||
|
||||
@@ -287,6 +287,10 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value == int.MaxValue)
|
||||
{
|
||||
|
||||
}
|
||||
SetProperty(ref _zIndex, value);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user