|
|
@@ -25,7 +25,7 @@ import {
|
|
|
} from './typings';
|
|
|
import { WorkflowHoverService, WorkflowSelectService } from './service';
|
|
|
import { WorkflowNodeLinesData } from './entity-datas/workflow-node-lines-data';
|
|
|
-import { WorkflowLineRenderData } from './entity-datas';
|
|
|
+import { WorkflowLineRenderData, WorkflowNodePortsData } from './entity-datas';
|
|
|
import {
|
|
|
LINE_HOVER_DISTANCE,
|
|
|
WorkflowLineEntity,
|
|
|
@@ -411,9 +411,8 @@ export class WorkflowLinesManager {
|
|
|
* @param pos
|
|
|
*/
|
|
|
getPortFromMousePos(pos: IPoint): WorkflowPortEntity | undefined {
|
|
|
- const allPorts = this.entityManager
|
|
|
- .getEntities<WorkflowPortEntity>(WorkflowPortEntity)
|
|
|
- .filter((port) => port.node.flowNodeType !== 'root');
|
|
|
+ const allNodes = this.getSortedNodes().reverse();
|
|
|
+ const allPorts = allNodes.map((node) => node.getData(WorkflowNodePortsData).allPorts).flat();
|
|
|
const targetPort = allPorts.find((port) => port.isHovered(pos.x, pos.y));
|
|
|
if (targetPort) {
|
|
|
const containNodes = this.getContainNodesFromMousePos(pos);
|
|
|
@@ -456,11 +455,13 @@ export class WorkflowLinesManager {
|
|
|
line.addData(WorkflowLineRenderData);
|
|
|
}
|
|
|
|
|
|
+ private getSortedNodes() {
|
|
|
+ return this.document.getAllNodes().sort((a, b) => this.getNodeIndex(a) - this.getNodeIndex(b));
|
|
|
+ }
|
|
|
+
|
|
|
/** 获取鼠标坐标位置的所有节点(stackIndex 从小到大排序) */
|
|
|
private getContainNodesFromMousePos(pos: IPoint): WorkflowNodeEntity[] {
|
|
|
- const allNodes = this.document
|
|
|
- .getAllNodes()
|
|
|
- .sort((a, b) => this.getNodeIndex(a) - this.getNodeIndex(b));
|
|
|
+ const allNodes = this.getSortedNodes();
|
|
|
const zoom =
|
|
|
this.entityManager.getEntity<PlaygroundConfigEntity>(PlaygroundConfigEntity)?.config?.zoom ||
|
|
|
1;
|