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

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
@@ -1487,7 +1487,8 @@ var WorkflowLinesManager = class {
1487
1487
  * @param pos
1488
1488
  */
1489
1489
  getPortFromMousePos(pos) {
1490
- const allPorts = this.entityManager.getEntities(WorkflowPortEntity).filter((port) => port.node.flowNodeType !== "root");
1490
+ const allNodes = this.getSortedNodes().reverse();
1491
+ const allPorts = allNodes.map((node) => node.getData(WorkflowNodePortsData).allPorts).flat();
1491
1492
  const targetPort = allPorts.find((port) => port.isHovered(pos.x, pos.y));
1492
1493
  if (targetPort) {
1493
1494
  const containNodes = this.getContainNodesFromMousePos(pos);
@@ -1522,9 +1523,12 @@ var WorkflowLinesManager = class {
1522
1523
  registerData(line) {
1523
1524
  line.addData(WorkflowLineRenderData);
1524
1525
  }
1526
+ getSortedNodes() {
1527
+ return this.document.getAllNodes().sort((a, b) => this.getNodeIndex(a) - this.getNodeIndex(b));
1528
+ }
1525
1529
  /** 获取鼠标坐标位置的所有节点(stackIndex 从小到大排序) */
1526
1530
  getContainNodesFromMousePos(pos) {
1527
- const allNodes = this.document.getAllNodes().sort((a, b) => this.getNodeIndex(a) - this.getNodeIndex(b));
1531
+ const allNodes = this.getSortedNodes();
1528
1532
  const zoom = this.entityManager.getEntity(PlaygroundConfigEntity2)?.config?.zoom || 1;
1529
1533
  const containNodes = allNodes.map((node) => {
1530
1534
  const { bounds } = node.getData(FlowNodeTransformData3);
@@ -2867,13 +2871,8 @@ var WorkflowDragService = class {
2867
2871
  return true;
2868
2872
  }
2869
2873
  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);
2874
+ const contentRect = new Rectangle8(bounds.x, bounds.y, padding.left * 2 / 3, bounds.height);
2875
+ return contentRect.contains(mousePos.x, mousePos.y);
2877
2876
  }
2878
2877
  /** 获取最近的 port */
2879
2878
  getNearestPort(node, mousePos) {