@flowgram.ai/free-layout-core 0.2.21 → 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 +16 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +16 -1
- package/dist/index.js.map +1 -1
- package/package.json +9 -9
package/dist/index.d.mts
CHANGED
|
@@ -137,6 +137,8 @@ declare class WorkflowDragService {
|
|
|
137
137
|
resetLine(line: WorkflowLineEntity, e: MouseEvent): Promise<void>;
|
|
138
138
|
/** 线条拖拽结束 */
|
|
139
139
|
onDragLineEnd(callback: OnDragLineEnd): Disposable;
|
|
140
|
+
/** 能否建立容器连线 */
|
|
141
|
+
private canBuildContainerLine;
|
|
140
142
|
/** 获取最近的 port */
|
|
141
143
|
private getNearestPort;
|
|
142
144
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -137,6 +137,8 @@ declare class WorkflowDragService {
|
|
|
137
137
|
resetLine(line: WorkflowLineEntity, e: MouseEvent): Promise<void>;
|
|
138
138
|
/** 线条拖拽结束 */
|
|
139
139
|
onDragLineEnd(callback: OnDragLineEnd): Disposable;
|
|
140
|
+
/** 能否建立容器连线 */
|
|
141
|
+
private canBuildContainerLine;
|
|
140
142
|
/** 获取最近的 port */
|
|
141
143
|
private getNearestPort;
|
|
142
144
|
}
|
package/dist/index.js
CHANGED
|
@@ -2797,7 +2797,7 @@ var WorkflowDragService = class {
|
|
|
2797
2797
|
type: "onDrag"
|
|
2798
2798
|
});
|
|
2799
2799
|
this.setLineColor(line, this.linesManager.lineColor.drawing);
|
|
2800
|
-
if (toNode) {
|
|
2800
|
+
if (toNode && this.canBuildContainerLine(toNode, dragPos)) {
|
|
2801
2801
|
toPort = this.getNearestPort(toNode, dragPos);
|
|
2802
2802
|
const { hasError } = this.handleDragOnNode(toNode, fromPort, line, toPort, originLine);
|
|
2803
2803
|
lineErrorReset = hasError;
|
|
@@ -2906,6 +2906,21 @@ var WorkflowDragService = class {
|
|
|
2906
2906
|
}
|
|
2907
2907
|
};
|
|
2908
2908
|
}
|
|
2909
|
+
/** 能否建立容器连线 */
|
|
2910
|
+
canBuildContainerLine(node, mousePos) {
|
|
2911
|
+
const isContainer = this.isContainer(node);
|
|
2912
|
+
if (!isContainer) {
|
|
2913
|
+
return true;
|
|
2914
|
+
}
|
|
2915
|
+
const { padding, bounds } = node.transform;
|
|
2916
|
+
const contentRect = new import_utils16.Rectangle(
|
|
2917
|
+
bounds.x + padding.left,
|
|
2918
|
+
bounds.y,
|
|
2919
|
+
bounds.width - padding.left - padding.right,
|
|
2920
|
+
bounds.height
|
|
2921
|
+
);
|
|
2922
|
+
return !contentRect.contains(mousePos.x, mousePos.y);
|
|
2923
|
+
}
|
|
2909
2924
|
/** 获取最近的 port */
|
|
2910
2925
|
getNearestPort(node, mousePos) {
|
|
2911
2926
|
const portsData = node.getData(WorkflowNodePortsData);
|