Skip to content

Commit

Permalink
fix: loop connection
Browse files Browse the repository at this point in the history
Closes #72
  • Loading branch information
abdul99ahad committed Sep 26, 2024
1 parent eb64b03 commit 3d841eb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
9 changes: 9 additions & 0 deletions lib/utils/layoutUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,15 @@ export function connectElements(source, target, layoutGrid) {
}
}

// negative dX indicates connection from future to past
if (dX < 0 && dY <= 0) {
return [
getDockingPoint(sourceMid, sourceBounds, 'b'),
{ x: sourceMid.x, y: sourceMid.y + DEFAULT_CELL_HEIGHT / 2 },
{ x: targetMid.x, y: sourceMid.y + DEFAULT_CELL_HEIGHT / 2 },
getDockingPoint(targetMid, targetBounds, 'b')
];
}
const directManhattan = directManhattanConnect(source, target, layoutGrid);

if (directManhattan) {
Expand Down
10 changes: 4 additions & 6 deletions test/snapshots/gateway.multiple.bpmn
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,10 @@
<di:waypoint x="657" y="210" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_137be2r_di" bpmnElement="Flow_137be2r">
<di:waypoint x="1025" y="210" />
<di:waypoint x="1050" y="210" />
<di:waypoint x="1050" y="140" />
<di:waypoint x="150" y="140" />
<di:waypoint x="150" y="70" />
<di:waypoint x="200" y="70" />
<di:waypoint x="975" y="250" />
<di:waypoint x="975" y="280" />
<di:waypoint x="225" y="280" />
<di:waypoint x="225" y="95" />
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
Expand Down

0 comments on commit 3d841eb

Please sign in to comment.