chore(layout): support { source, target } hints in BpmnLayouter

Closes #743
This commit is contained in:
Nico Rehwaldt 2017-12-22 11:08:49 +01:00 committed by merge-me[bot]
parent 883d6c8ad3
commit d90f048e8c
1 changed files with 5 additions and 9 deletions

View File

@ -31,8 +31,8 @@ inherits(BpmnLayouter, BaseLayouter);
BpmnLayouter.prototype.layoutConnection = function(connection, hints) {
hints = hints || {};
var source = connection.source,
target = connection.target,
var source = hints.source || connection.source,
target = hints.target || connection.target,
waypoints = connection.waypoints,
start = hints.connectionStart,
end = hints.connectionEnd;
@ -54,7 +54,7 @@ BpmnLayouter.prototype.layoutConnection = function(connection, hints) {
if (is(connection, 'bpmn:Association') ||
is(connection, 'bpmn:DataAssociation')) {
if (waypoints && !isCompensationAssociation(connection)) {
if (waypoints && !isCompensationAssociation(source, target)) {
return [].concat([ start ], waypoints.slice(1, -1), [ end ]);
}
}
@ -75,7 +75,7 @@ BpmnLayouter.prototype.layoutConnection = function(connection, hints) {
// (3) loops from / to the same element
//
if (is(connection, 'bpmn:SequenceFlow') ||
isCompensationAssociation(connection)) {
isCompensationAssociation(source, target)) {
if (source === target) {
manhattanOptions = {
@ -189,11 +189,7 @@ function getConnectionDocking(point, shape) {
return point ? (point.original || point) : getMid(shape);
}
function isCompensationAssociation(connection) {
var source = connection.source,
target = connection.target;
function isCompensationAssociation(source, target) {
return is(target, 'bpmn:Activity') &&
is(source, 'bpmn:BoundaryEvent') &&
target.businessObject.isForCompensation;