优化了Workbench画布节点创建相关的代码逻辑

This commit is contained in:
fengjiayi
2025-06-01 12:21:38 +08:00
parent 84390b574f
commit 401c0e42d9
13 changed files with 119 additions and 114 deletions

View File

@@ -35,11 +35,6 @@ namespace Serein.Workbench.Services
/// </summary>
public Action<FlowCanvasView> OnRemoveFlowCanvasView { get; set; }
/// <summary>
/// 添加了节点
/// </summary>
public Action<NodeControlBase> OnCreateNode { get; set; }
/// <summary>
/// 查看的画布发生改变
/// </summary>
@@ -356,7 +351,11 @@ namespace Serein.Workbench.Services
nodeMVVM.ViewModelType, // 控件VIewModel类型
nodeModel, // 控件数据实体
nodeCanvas); // 所在画布
OnCreateNode.Invoke(nodeControl); // 创建节点
if(nodeCanvas is IFlowCanvas flowCanvas)
{
flowCanvas.Add(nodeControl); // 创建节点
}
}
catch (Exception ex)
{