diff --git a/lib/utils/layoutUtil.js b/lib/utils/layoutUtil.js
index bbd76d4..7edd72e 100644
--- a/lib/utils/layoutUtil.js
+++ b/lib/utils/layoutUtil.js
@@ -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) {
diff --git a/test/snapshots/gateway.multiple.bpmn b/test/snapshots/gateway.multiple.bpmn
index 36f7a89..aeebd97 100644
--- a/test/snapshots/gateway.multiple.bpmn
+++ b/test/snapshots/gateway.multiple.bpmn
@@ -111,12 +111,10 @@
-
-
-
-
-
-
+
+
+
+