@flowgram.ai/free-layout-core 0.2.20 → 0.2.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/esm/index.js CHANGED
@@ -2751,7 +2751,7 @@ var WorkflowDragService = class {
2751
2751
  type: "onDrag"
2752
2752
  });
2753
2753
  this.setLineColor(line, this.linesManager.lineColor.drawing);
2754
- if (toNode) {
2754
+ if (toNode && this.canBuildContainerLine(toNode, dragPos)) {
2755
2755
  toPort = this.getNearestPort(toNode, dragPos);
2756
2756
  const { hasError } = this.handleDragOnNode(toNode, fromPort, line, toPort, originLine);
2757
2757
  lineErrorReset = hasError;
@@ -2860,6 +2860,21 @@ var WorkflowDragService = class {
2860
2860
  }
2861
2861
  };
2862
2862
  }
2863
+ /** 能否建立容器连线 */
2864
+ canBuildContainerLine(node, mousePos) {
2865
+ const isContainer = this.isContainer(node);
2866
+ if (!isContainer) {
2867
+ return true;
2868
+ }
2869
+ const { padding, bounds } = node.transform;
2870
+ const contentRect = new Rectangle8(
2871
+ bounds.x + padding.left,
2872
+ bounds.y,
2873
+ bounds.width - padding.left - padding.right,
2874
+ bounds.height
2875
+ );
2876
+ return !contentRect.contains(mousePos.x, mousePos.y);
2877
+ }
2863
2878
  /** 获取最近的 port */
2864
2879
  getNearestPort(node, mousePos) {
2865
2880
  const portsData = node.getData(WorkflowNodePortsData);