Parcourir la source

feat(canvas-core): node padding area should be include in port bounds calculation

liuyangxing il y a 10 mois
Parent
commit
f5abe5b1df

+ 3 - 2
packages/canvas-engine/free-layout-core/src/entities/workflow-port-entity.ts

@@ -1,4 +1,5 @@
 import { type IPoint, Rectangle, Emitter } from '@flowgram.ai/utils';
+import { FlowNodeTransformData } from '@flowgram.ai/document';
 import {
   Entity,
   type EntityOpts,
@@ -129,7 +130,7 @@ export class WorkflowPortEntity extends Entity<WorkflowPortEntityOpts> {
 
   get point(): IPoint {
     const { targetElement } = this;
-    const { bounds } = this.node.getData(TransformData)!;
+    const { bounds } = this.node.getData(FlowNodeTransformData)!;
     if (targetElement) {
       const pos = domReactToBounds(targetElement.getBoundingClientRect()).center;
       return this.entityManager
@@ -164,7 +165,7 @@ export class WorkflowPortEntity extends Entity<WorkflowPortEntityOpts> {
    */
   get relativePosition(): IPoint {
     const { point } = this;
-    const { bounds } = this.node.getData(TransformData)!;
+    const { bounds } = this.node.getData(FlowNodeTransformData)!;
     return {
       x: point.x - bounds.x,
       y: point.y - bounds.y,