重新设计了@get 表达式,修改了 Workbench后台长时间运行时,重新切换到前台会产生参数连接线错误显示的问题

This commit is contained in:
fengjiayi
2024-12-18 00:05:42 +08:00
parent 587f7cffb2
commit 0471452ed9
16 changed files with 386 additions and 306 deletions

View File

@@ -113,6 +113,11 @@ namespace Serein.Workbench.Node.View
/// </summary>
public ConnectionInvokeType InvokeType { get; }
/// <summary>
/// 目标节点控制点
/// </summary>
private INodeJunction EndNode;
/// <summary>
/// 获取参数类型,第几个参数
/// </summary>
@@ -138,6 +143,8 @@ namespace Serein.Workbench.Node.View
/// </summary>
private ConnectionLineShape BezierLine;
private LineType LineType;
/// <summary>
@@ -168,7 +175,8 @@ namespace Serein.Workbench.Node.View
int argIndex,
ConnectionArgSourceType argSourceType,
JunctionControlBase Start,
JunctionControlBase End)
JunctionControlBase End,
INodeJunction nodeJunction)
{
this.LineType = LineType;
this.Canvas = Canvas;
@@ -176,6 +184,7 @@ namespace Serein.Workbench.Node.View
this.ArgSourceType = argSourceType;
this.Start = Start;
this.End = End;
this.EndNode = nodeJunction;
InitElementPoint();
}
@@ -242,6 +251,10 @@ namespace Serein.Workbench.Node.View
/// </summary>
public void RefreshLine()
{
if(ArgIndex > -1)
{
End = EndNode.GetJunctionOfArgData(ArgIndex);
}
(Point startPoint, Point endPoint) = RefreshPoint(Canvas, Start, End);
BezierLine.UpdatePoints(startPoint, endPoint);
}
@@ -255,7 +268,6 @@ namespace Serein.Workbench.Node.View
private (Point startPoint, Point endPoint) RefreshPoint(Canvas canvas, FrameworkElement startElement, FrameworkElement endElement)
{
var startPoint = startElement.TranslatePoint(rightCenterOfStartLocation, canvas); // 获取起始节点的中心位置
var endPoint = endElement.TranslatePoint(leftCenterOfEndLocation, canvas); // 计算终点位置
return (startPoint, endPoint);