Răsfoiți Sursa

fix(demo): create node init position offset (#500)

Louis Young 6 luni în urmă
părinte
comite
0a8bc232ed

+ 4 - 0
apps/demo-free-layout/src/nodes/condition/index.ts

@@ -22,6 +22,10 @@ export const ConditionNodeRegistry: FlowNodeRegistry = {
     // Condition Outputs use dynamic port
     useDynamicPort: true,
     expandable: false, // disable expanded
+    size: {
+      width: 360,
+      height: 210,
+    },
   },
   formMeta,
   onAdd() {

+ 4 - 4
apps/demo-free-layout/src/nodes/loop/index.ts

@@ -36,8 +36,8 @@ export const LoopNodeRegistry: FlowNodeRegistry = {
      * 子画布默认大小设置
      */
     size: {
-      width: 560,
-      height: 400,
+      width: 424,
+      height: 244,
     },
     /**
      * The subcanvas padding setting
@@ -81,7 +81,7 @@ export const LoopNodeRegistry: FlowNodeRegistry = {
           meta: {
             position: {
               x: -80,
-              y: 0,
+              y: 120,
             },
           },
           data: {},
@@ -92,7 +92,7 @@ export const LoopNodeRegistry: FlowNodeRegistry = {
           meta: {
             position: {
               x: 80,
-              y: 0,
+              y: 120,
             },
           },
           data: {},

+ 2 - 7
packages/canvas-engine/free-layout-core/src/service/workflow-drag-service.ts

@@ -787,13 +787,8 @@ export class WorkflowDragService {
       return true;
     }
     const { padding, bounds } = node.transform;
-    const contentRect = new Rectangle(
-      bounds.x + padding.left,
-      bounds.y,
-      bounds.width - padding.left - padding.right,
-      bounds.height
-    );
-    return !contentRect.contains(mousePos.x, mousePos.y);
+    const contentRect = new Rectangle(bounds.x, bounds.y, (padding.left * 2) / 3, bounds.height);
+    return contentRect.contains(mousePos.x, mousePos.y);
   }
 
   /** 获取最近的 port */