Explorar el Código

fix(core): correct root node output point calculation and transition line drawing (#997)

Louis Young hace 1 mes
padre
commit
75acd3db0f

+ 3 - 0
packages/canvas-engine/document/src/datas/flow-node-transition-data.ts

@@ -7,6 +7,7 @@ import { Point } from '@flowgram.ai/utils';
 import { EntityData } from '@flowgram.ai/core';
 
 import {
+  FlowNodeBaseType,
   type FlowTransitionLabel,
   FlowTransitionLabelEnum,
   type FlowTransitionLine,
@@ -42,8 +43,10 @@ export const drawLineToBottom = (transition: FlowNodeTransitionData) => {
   const { transform } = transition;
 
   const currentOutput = transform.outputPoint;
+  const isParentRoot = transform.parent?.entity.flowNodeType === FlowNodeBaseType.ROOT;
   const parentOutput = transform.parent?.outputPoint;
   if (
+    !isParentRoot &&
     !transform.next &&
     parentOutput &&
     !new Point().copyFrom(currentOutput).equals(parentOutput) &&

+ 1 - 1
packages/canvas-engine/fixed-layout-core/src/activities/root.ts

@@ -18,6 +18,6 @@ export const RootRegistry: FlowNodeRegistry = {
     return transform.firstChild?.inputPoint || transform.bounds.topCenter;
   },
   getOutputPoint(transform) {
-    return transform.firstChild?.outputPoint || transform.bounds.bottomCenter;
+    return transform.lastChild?.outputPoint || transform.bounds.bottomCenter;
   },
 };