block使用linklist重写,把代码复杂度降低点

This commit is contained in:
艾竹
2023-08-12 22:58:24 +08:00
parent 8f7a43accd
commit 9485ce6684
10 changed files with 1339 additions and 213 deletions

View File

@@ -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
}

View File

@@ -370,11 +370,7 @@ namespace AIStudio.Wpf.DiagramDesigner
{
get; set;
} = true;
public double BeyondBoundary
{
get; set;
} = -1;
}
public class SnappingOption

View File

@@ -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)

View File

@@ -287,6 +287,10 @@ namespace AIStudio.Wpf.DiagramDesigner
}
set
{
if (value == int.MaxValue)
{
}
SetProperty(ref _zIndex, value);
}
}