diff --git a/lib/features/modeling/BpmnLayouter.js b/lib/features/modeling/BpmnLayouter.js index 028fcfe2..6bb3867c 100644 --- a/lib/features/modeling/BpmnLayouter.js +++ b/lib/features/modeling/BpmnLayouter.js @@ -37,8 +37,13 @@ BpmnLayouter.prototype.layoutConnection = function(connection, hints) { var manhattanOptions, updatedWaypoints; - start = getConnectionDocking(waypoints, 0, source, start); - end = getConnectionDocking(waypoints, waypoints && waypoints.length - 1, target, end); + if (!start) { + start = getConnectionDocking(waypoints && waypoints[0], source); + } + + if (!end) { + end = getConnectionDocking(waypoints && waypoints[waypoints.length - 1], target); + } // TODO(nikku): support vertical modeling // and invert preferredLayouts accordingly @@ -47,7 +52,7 @@ BpmnLayouter.prototype.layoutConnection = function(connection, hints) { is(connection, 'bpmn:DataAssociation')) { if (waypoints && !isCompensationAssociation(connection)) { - return waypoints; + return [].concat([ start ], waypoints.slice(1, -1), [ end ]); } } @@ -167,10 +172,8 @@ function getAttachOrientation(attachedElement) { } -function getConnectionDocking(waypoints, idx, shape, defaultPoint) { - var point = waypoints && waypoints[idx]; - - return point ? (point.original || point) : (defaultPoint || getMid(shape)); +function getConnectionDocking(point, shape) { + return point ? (point.original || point) : getMid(shape); } function isCompensationAssociation(connection) {