完成退出线布局算法

This commit is contained in:
zengwenjie
2025-09-17 10:00:46 +08:00
parent d7149a570d
commit 0f616421ec
4 changed files with 49 additions and 32 deletions

View File

@@ -554,33 +554,28 @@ namespace Deedy.Activity
this.IsSelectable = true;
}
if (newValue is ICombinedElement newCombinedElement)
if (newValue is ICombinedElement newCombined)
{
this.IsExpandable = true;
this.ElementCount = newCombinedElement.Elements.Count;
newCombinedElement.Elements.CollectionChanged += Elements_CollectionChanged;
this.ElementCount = newCombined.Elements.Count;
newCombined.Elements.CollectionChanged += Elements_CollectionChanged;
}
else this.IsExpandable = false;
if (newValue is ICriticalZoneManageable criticalZoneManageable)
if (newValue is ICriticalZoneManageable criticalZone)
{
if (criticalZoneManageable.IsLeaveZoneHidden) this.ShowLeaveZone = Visibility.Collapsed;
if (criticalZoneManageable.IsEntryZoneHidden) this.ShowEntryZone = Visibility.Collapsed;
if (criticalZone.IsLeaveZoneHidden) this.ShowLeaveZone = Visibility.Collapsed;
if (criticalZone.IsEntryZoneHidden) this.ShowEntryZone = Visibility.Collapsed;
}
if (newValue is IExitlineManageable exitlinemanageable)
if (newValue is IContainerWithExitline withExitline)
{
if ((exitlinemanageable.ExitlinePosition & ExitlinePosition.LeftLower) == ExitlinePosition.LeftLower)
if (withExitline.ExitlinePosition.HasFlag(ExitlinePosition.LeftLower))
this.ShowLeftExitline = Visibility.Visible;
else if ((exitlinemanageable.ExitlinePosition & ExitlinePosition.Rightlower) == ExitlinePosition.Rightlower)
if (withExitline.ExitlinePosition.HasFlag(ExitlinePosition.Rightlower))
this.ShowRightExitline = Visibility.Visible;
else if ((exitlinemanageable.ExitlinePosition & ExitlinePosition.Underline) == ExitlinePosition.Underline)
{
this.ShowLeftExitline = Visibility.Visible;
this.ShowRightExitline = Visibility.Visible;
}
this.ActionElement.AdjustExitlinePosition();
// 新元素被托管渲染后调整子元素退出线位置
withExitline.AdjustExitlinePosition();
}
if (newValue is ILogicController logicController)
{
@@ -591,8 +586,7 @@ namespace Deedy.Activity
case LogicalBehavior.Break: this.ShowBreakHandle = Visibility.Visible; break;
case LogicalBehavior.Continue: this.ShowContinueHandle = Visibility.Visible; break;
case LogicalBehavior.Customize: this.ShowCustomizeHandle = Visibility.Visible; break;
default:
break;
default: break;
}
}
//TODO根据节点的特征与当前工作状态来判定如何处理当前视图的属性
@@ -607,6 +601,8 @@ namespace Deedy.Activity
this.IsExpanded = true;
this.ElementCount = combined.Elements.Count;
}
// 节点集合变更时调整退出线位置
if (this.ActionElement is IContainerWithExitline container) container.AdjustExitlinePosition();
}
protected virtual void ActionElement_PropertyChanged(object? sender, PropertyChangedEventArgs e)
@@ -617,8 +613,9 @@ namespace Deedy.Activity
case nameof(IActionElement.InstantInfo):
this.InstantInfo = this.ActionElement.InstantInfo;
break;
case nameof(IExitlineManageable):
this.ActionElement.AdjustExitlinePosition();
case nameof(IContainerWithExitline.ExitlinePosition):
// 自身退出线变更时调整所有子节点退出线位置
(this.ActionElement as IContainerWithExitline)?.AdjustExitlinePosition();
break;
default: break;
}